2020-02-19 16:37:46 +00:00
|
|
|
let
|
2020-03-22 16:14:20 +00:00
|
|
|
# This is either a path to a local nix-bitcoin source or an attribute set to
|
|
|
|
# be used as the fetchurl argument.
|
|
|
|
nix-bitcoin-release = import ./nix-bitcoin-release.nix;
|
|
|
|
|
|
|
|
nix-bitcoin-path =
|
|
|
|
if builtins.isAttrs nix-bitcoin-release then nix-bitcoin-unpacked
|
|
|
|
else nix-bitcoin-release;
|
|
|
|
|
2020-02-19 16:37:46 +00:00
|
|
|
nixpkgs-path = (import "${toString nix-bitcoin-path}/pkgs/nixpkgs-pinned.nix").nixpkgs;
|
|
|
|
nixpkgs = import nixpkgs-path {};
|
|
|
|
nix-bitcoin = nixpkgs.callPackage nix-bitcoin-path {};
|
2020-02-26 16:11:23 +00:00
|
|
|
|
|
|
|
extraContainer = nixpkgs.callPackage (builtins.fetchTarball {
|
|
|
|
url = "https://github.com/erikarvstedt/extra-container/archive/6cced2c26212cc1c8cc7cac3547660642eb87e71.tar.gz";
|
|
|
|
sha256 = "0qr41mma2iwxckdhqfabw3vjcbp2ffvshnc3k11kwriwj14b766v";
|
|
|
|
}) {};
|
2020-03-22 16:14:20 +00:00
|
|
|
|
|
|
|
nix-bitcoin-unpacked = (import <nixpkgs> {}).runCommand "nix-bitcoin-src" {} ''
|
|
|
|
mkdir $out; tar xf ${builtins.fetchurl nix-bitcoin-release} -C $out
|
|
|
|
'';
|
2020-02-19 16:37:46 +00:00
|
|
|
in
|
|
|
|
with nixpkgs;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "nix-bitcoin-environment";
|
|
|
|
|
2020-02-26 16:11:23 +00:00
|
|
|
buildInputs = [ nix-bitcoin.nixops19_09 figlet extraContainer ];
|
2020-02-19 16:37:46 +00:00
|
|
|
|
|
|
|
shellHook = ''
|
|
|
|
export NIX_PATH="nixpkgs=${nixpkgs-path}:nix-bitcoin=${toString nix-bitcoin-path}:."
|
2020-03-22 16:14:20 +00:00
|
|
|
alias fetch-release="${toString nix-bitcoin-path}/helper/fetch-release"
|
2020-02-26 16:11:23 +00:00
|
|
|
|
2020-02-19 16:37:46 +00:00
|
|
|
# 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=""
|
2020-02-26 16:11:23 +00:00
|
|
|
|
2020-02-19 16:37:46 +00:00
|
|
|
figlet "nix-bitcoin"
|
|
|
|
(mkdir -p secrets; cd secrets; ${nix-bitcoin.generate-secrets})
|
2020-03-29 16:21:12 +00:00
|
|
|
|
|
|
|
# Don't run this hook when another nix-shell is run inside this shell
|
|
|
|
unset shellHook
|
2020-02-19 16:37:46 +00:00
|
|
|
'';
|
|
|
|
}
|