dotfiles/conf
2017-01-30 17:41:05 +01:00

21 lines
666 B
Bash
Executable file

#!/usr/bin/env bash
if ! [ -e deploy_key ] || ! [ -e secrets.nix ]
then
gpg --decrypt-files secrets.nix.asc deploy_key.asc keys/*.asc
sudo chgrp nixbld deploy_key
chmod 640 deploy_key
fi
export NIX_PATH="ssh-id-file=`pwd`/deploy_key":secrets=`pwd`/secrets.nix
case $1 in
stable)
export NIX_PATH="nixpkgs=https://nixos.org/channels/nixos-16.09/nixexprs.tar.xz:nixos-config=`pwd`/$2/configuration.nix:$NIX_PATH"
eval ${@:3}
;;
channel)
export NIX_PATH="/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=`pwd`/$2/configuration.nix:$NIX_PATH"
eval ${@:3}
;;
update-encrypt)
gpg -a -r yorick --encrypt-files secrets.nix deploy_key keys/*.key
esac