l mors.r: add deploy/predeploy helpers

This commit is contained in:
lassulus 2017-10-09 13:19:27 +02:00
parent a3f45e80ae
commit 1b6956cb0d

View File

@ -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'
'';
};
}