improve examples/shell.nix

The user's local node configuration directory usually contains a copy of
examples/shell.nix.

1. Move the shell implementation from shell.nix to nix-bitcoin/helper/makeShell.nix
   Because the shell is no longer defined locally in the user's config
   directory, we can now ship new shell features via nix-bitcoin updates.

2. Simplify examples/nix-bitcoin-release.nix
   nix-bitcoin-release.nix, as generated via `fetch-release`, now
   contains a simple fetchTarball statement which can be directly imported.
   This allows us to get rid of the extra `nix-bitcoin-unpacked` derivation
   which adds a dependency on the user's local nixpkgs.

   To keep `fetch-release` as simple as possible for easy auditing, we just
   fetch and verify a `nar-hash.txt` file that is now uploaded
   via `push-release.sh`.

A migration guide for updating the user's local `shell.nix` is
automatically printed when the user starts a new shell after updating
nix-bitcoin.
This is achieved by throwing an error in `generate-secrets`, which is called
on shell startup.

This commit is required to deploy the new extensible `generate-secrets`
mechanism introduced in the next commit.
This commit is contained in:
Erik Arvstedt
2021-09-08 17:01:17 +02:00
parent 8a757e0486
commit 24fd1e9bdc
7 changed files with 86 additions and 64 deletions

View File

@@ -9,7 +9,7 @@ let self = {
spark-wallet = pkgs.callPackage ./spark-wallet { };
liquid-swap = pkgs.python3Packages.callPackage ./liquid-swap { };
joinmarket = pkgs.callPackage ./joinmarket { inherit (self) nbPython3Packages; };
generate-secrets = pkgs.callPackage ./generate-secrets { };
generate-secrets = import ./generate-secrets-deprecated.nix;
nixops19_09 = pkgs.callPackage ./nixops { };
krops = import ./krops { };
netns-exec = pkgs.callPackage ./netns-exec { };

View File

@@ -0,0 +1,14 @@
throw ''
Please update the `shell.nix` of your node configuration.
To update, do the following:
1. Switch to the directory containing your `configuration.nix` and `shell.nix`.
2. Run the following Bash expression (Warning: This overwrites your `shell.nix`):
# Only update nix-bitcoin-release.nix if it contains a release hash
if grep -q sha256 nix-bitcoin-release.nix; then
${toString ../helper/fetch-release} > nix-bitcoin-release.nix && cp ${toString ../examples/shell.nix} .
else
cp ${toString ../examples/shell.nix} .
fi
''