Change the nix-bitcoin deployment from forking this repo to importing the module

Instead of forking this repo, it is now recommended that users simply import the
nix-bitcoin module. This commit adds an example directory that contains the
network/ examples and a shell.nix for deployment with nixops.
This commit is contained in:
Jonas Nick 2020-02-19 16:37:46 +00:00
parent 2d51c722cc
commit 87d0286498
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
7 changed files with 33 additions and 8 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
/secrets/ /example/secrets/

View File

@ -4,8 +4,6 @@
{ config, pkgs, lib, ... }: { { config, pkgs, lib, ... }: {
imports = [ imports = [
./modules/nix-bitcoin.nix
# Use hardened kernel profile. See # Use hardened kernel profile. See
# https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/hardened.nix # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/hardened.nix
# for the enabled options. # for the enabled options.

View File

@ -3,7 +3,7 @@
bitcoin-node = bitcoin-node =
{ config, pkgs, lib, ... }: { { config, pkgs, lib, ... }: {
imports = [ ../configuration.nix ]; imports = [ ../configuration.nix <nix-bitcoin/modules/nix-bitcoin.nix> ];
deployment.keys = builtins.mapAttrs (n: v: { deployment.keys = builtins.mapAttrs (n: v: {
keyFile = "${toString ../secrets}/${n}"; keyFile = "${toString ../secrets}/${n}";

29
examples/shell.nix Normal file
View File

@ -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})
'';
}

View File

@ -1,13 +1,12 @@
let let
nixpkgs = (import ./pkgs/nixpkgs-pinned.nix).nixpkgs; nixpkgs = (import ./pkgs/nixpkgs-pinned.nix).nixpkgs;
in in
with import nixpkgs { }; with import nixpkgs {};
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "nix-bitcoin-environment"; name = "nix-bitcoin-environment";
nixops19_09 = callPackage ./pkgs/nixops {}; nixops19_09 = callPackage ./pkgs/nixops {};
make-secrets = callPackage ./pkgs/generate-secrets/update-and-generate.nix {};
buildInputs = [ nixops19_09 figlet ]; 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 # from 10.1.1.200 port 22:2: Too many authentication failures` if I have a few
# keys already added to my ssh-agent. # keys already added to my ssh-agent.
export SSH_AUTH_SOCK="" export SSH_AUTH_SOCK=""
figlet "nix-bitcoin" figlet "nix-bitcoin dev shell"
(mkdir -p secrets; cd secrets; ${make-secrets})
''; '';
} }