Add env for nix-shell which pins nixpkgs and automatically creates secrets

This commit is contained in:
Jonas Nick 2019-01-01 20:17:07 +00:00
parent 5e4e959e26
commit d02749bc36
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
2 changed files with 21 additions and 3 deletions

20
env.nix Normal file
View File

@ -0,0 +1,20 @@
let
# Pin nixpkgs
nixpkgs = builtins.fetchGit {
url = "https://github.com/nixos/nixpkgs-channels";
ref = "nixos-18.09";
rev = "0396345b79436f54920f7eb651ab42acf2eb7973";
};
in
with import nixpkgs { };
stdenv.mkDerivation rec {
name = "nix-bitcoin-environment";
buildInputs = [ pkgs.nixops pkgs.figlet pkgs.apg ];
shellHook = ''
figlet "nix-bitcoin"
./secrets/generate_secrets.sh
'';
}

View File

@ -1,15 +1,13 @@
#!/bin/bash
SECRETSFILE=secrets/secrets.nix
mkdir -p secrets
if [ -e "$SECRETSFILE" ]; then
echo $SECRETSFILE already exists
echo $SECRETSFILE already exists. No new secrets were generated.
exit 1
fi
echo Installing apg through nix-env
nix-env -i apg
echo Write secrets to $SECRETSFILE
{
echo \{