diff --git a/.gitignore b/.gitignore index 5598d80..cad76d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/secrets/ +/example/secrets/ diff --git a/configuration.nix b/examples/configuration.nix similarity index 99% rename from configuration.nix rename to examples/configuration.nix index 8fe2714..d3bc697 100644 --- a/configuration.nix +++ b/examples/configuration.nix @@ -4,8 +4,6 @@ { config, pkgs, lib, ... }: { imports = [ - ./modules/nix-bitcoin.nix - # Use hardened kernel profile. See # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/hardened.nix # for the enabled options. diff --git a/network/network-libvirtd.nix b/examples/nixops/node-libvirtd.nix similarity index 100% rename from network/network-libvirtd.nix rename to examples/nixops/node-libvirtd.nix diff --git a/network/network-vbox.nix b/examples/nixops/node-vbox.nix similarity index 100% rename from network/network-vbox.nix rename to examples/nixops/node-vbox.nix diff --git a/network/network.nix b/examples/nixops/node.nix similarity index 93% rename from network/network.nix rename to examples/nixops/node.nix index fa69939..e183870 100644 --- a/network/network.nix +++ b/examples/nixops/node.nix @@ -3,7 +3,7 @@ bitcoin-node = { config, pkgs, lib, ... }: { - imports = [ ../configuration.nix ]; + imports = [ ../configuration.nix ]; deployment.keys = builtins.mapAttrs (n: v: { keyFile = "${toString ../secrets}/${n}"; diff --git a/examples/shell.nix b/examples/shell.nix new file mode 100644 index 0000000..cb224d5 --- /dev/null +++ b/examples/shell.nix @@ -0,0 +1,29 @@ +let + # TODO: + # nix-bitcoin-path = builtins.fetchTarball { + # url = "https://github.com/fort-nix/nix-bitcoin/archive/master.tar.gz"; + # sha256 = "1mlvfakjgbl67k4k9mgafp5gvi2gb2p57xwxwffqr4chx8g848n7"; + # }; + nix-bitcoin-path = ../.; + nixpkgs-path = (import "${toString nix-bitcoin-path}/pkgs/nixpkgs-pinned.nix").nixpkgs; + nixpkgs = import nixpkgs-path {}; + nix-bitcoin = nixpkgs.callPackage nix-bitcoin-path {}; +in +with nixpkgs; + +stdenv.mkDerivation rec { + name = "nix-bitcoin-environment"; + + buildInputs = [ nix-bitcoin.nixops19_09 figlet ]; + + shellHook = '' + export NIX_PATH="nixpkgs=${nixpkgs-path}:nix-bitcoin=${toString nix-bitcoin-path}:." + # ssh-agent and nixops don't play well together (see + # https://github.com/NixOS/nixops/issues/256). I'm getting `Received disconnect + # from 10.1.1.200 port 22:2: Too many authentication failures` if I have a few + # keys already added to my ssh-agent. + export SSH_AUTH_SOCK="" + figlet "nix-bitcoin" + (mkdir -p secrets; cd secrets; ${nix-bitcoin.generate-secrets}) + ''; +} diff --git a/shell.nix b/shell.nix index 45ab264..1838396 100644 --- a/shell.nix +++ b/shell.nix @@ -1,13 +1,12 @@ let nixpkgs = (import ./pkgs/nixpkgs-pinned.nix).nixpkgs; in -with import nixpkgs { }; +with import nixpkgs {}; stdenv.mkDerivation rec { name = "nix-bitcoin-environment"; nixops19_09 = callPackage ./pkgs/nixops {}; - make-secrets = callPackage ./pkgs/generate-secrets/update-and-generate.nix {}; buildInputs = [ nixops19_09 figlet ]; @@ -18,7 +17,6 @@ stdenv.mkDerivation rec { # from 10.1.1.200 port 22:2: Too many authentication failures` if I have a few # keys already added to my ssh-agent. export SSH_AUTH_SOCK="" - figlet "nix-bitcoin" - (mkdir -p secrets; cd secrets; ${make-secrets}) + figlet "nix-bitcoin dev shell" ''; }