#!/usr/bin/env bash if ! [ -e deploy_key ] || ! [ -e secrets.nix ] then git crypt unlock 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} ;; checkout) export NIX_PATH="nixpkgs=`pwd`/../nixpkgs: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} ;; esac