summaryrefslogtreecommitdiffstats
path: root/lass/1systems/mors/config.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lass/1systems/mors/config.nix')
-rw-r--r--lass/1systems/mors/config.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/lass/1systems/mors/config.nix b/lass/1systems/mors/config.nix
index 8b90cce77..610bfef8e 100644
--- a/lass/1systems/mors/config.nix
+++ b/lass/1systems/mors/config.nix
@@ -157,4 +157,38 @@ with import <stockholm/lib>;
krebs.repo-sync.timerConfig = {
OnCalendar = "00:37";
};
+
+ environment.shellAliases = {
+ deploy = pkgs.writeDash "deploy" ''
+ set -eu
+ export PATH=${makeBinPath [
+ pkgs.bash
+ pkgs.coreutils
+ pkgs.nix
+ (pkgs.writeDashBin "is-git-crypt-locked" ''
+ magic=$(dd status=none if="$1" skip=1 bs=1 count=8)
+ test "$magic" = GITCRYPT
+ '')
+ ]}
+ cd ~/stockholm
+ export SYSTEM="$1"
+ if is-git-crypt-locked ~/secrets/ready; then
+ echo 'secrets are crypted' >&2
+ exit 23
+ else
+ exec nix-shell -I stockholm="$PWD" --run 'deploy --system="$SYSTEM"'
+ fi
+ '';
+ predeploy = pkgs.writeDash "predeploy" ''
+ set -eu
+ export PATH=${makeBinPath [
+ pkgs.bash
+ pkgs.coreutils
+ pkgs.nix
+ ]}
+ cd ~/stockholm
+ export SYSTEM="$1"
+ exec nix-shell -I stockholm="$PWD" --run 'test --system="$SYSTEM" --target="$SYSTEM/var/test/" --force-populate'
+ '';
+ };
}