summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2017-10-09 13:19:27 +0200
committerlassulus <lassulus@lassul.us>2017-10-09 13:19:27 +0200
commit1b6956cb0d5ba3c28cb770a38e667ae10739f2b9 (patch)
treefb630a8d033de90ff20a98957a22e626297bf33c
parenta3f45e80aeffe7223631793dcb48f9cabfe7215a (diff)
l mors.r: add deploy/predeploy helpers
-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'
+ '';
+ };
}