dotfiles/conf

25 lines
802 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
git)
export NIX_PATH="nixpkgs=https://github.com/NixOS/nixpkgs/archive/master.tar.gz:nixos-config=`pwd`/logical/$2.nix:$NIX_PATH"
eval ${@:3}
;;
stable)
export NIX_PATH="nixpkgs=https://nixos.org/channels/nixos-17.03/nixexprs.tar.xz:nixos-config=`pwd`/logical/$2.nix:$NIX_PATH"
eval ${@:3}
;;
channel)
export NIX_PATH="/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=`pwd`/logical/$2.nix:$NIX_PATH"
eval ${@:3}
;;
update-encrypt)
gpg -a -r yorick --encrypt-files secrets.nix deploy_key keys/*.key
esac