By using the `default` flake module for tests, `pkgsUnstable` in
`pkgs/default.nix` gets passed the `nixpkgs-unstable` flake input
instead of falling back to importing `nixpkgsPinned.nixpkgs-unstable`.
For some use cases this prevents importing `nixpkgs-unstable` twice
(once via the `nixpkgs-unstable` flake input, once via
`import nixpkgsPinned.nixpkgs-unstable`).
Advantages:
- Pure test evaluations
- The test framework can now be used by flakes that extend nix-bitcoin
- Most features of `run-tests.sh` are now accessible via `nix build`/`nix run`.
We keep `run-tests.sh` for advanced features like `scenarioOverridesFile` and adhoc scenarios.
Other changes:
- `run-tests.sh` now builds aggregate VM tests like `basic` or
`buildable` by creating all VMs in a single evaluation.
This speeds up the tests and eases debugging by separating the eval and build steps.
- Use the new `nix` CLI which has improved build output logging
by prefixing output lines with the origin drv name.
`nixpkgs.legacyPackages.${system}` allows reusing a single pkgs instance
that is shared among all flakes with the same `nixpkgs` input.
This is relevant when a user overrides the `nixpkgs` input of our flake
or exports our `nixpkgs` input to other flakes.
`import nixpkgs` would create a new pkgs instance instead.
Instead of providing two NixOS modules (one for using system pkgs,
one for using locked pkgs), provide a single module with option
`useVersionLockedPkgs`.
This fixes that all nix-bitcoin options are displayed twice
on search.nixos.org:
https://search.nixos.org/flakes?type=options&query=clightning
Silences warnings in `nix flake check`.
- Define `mkNbPkgs` under attr `lib`.
`lib` still triggers a warning, but it is expected to be a standard
flake attr in a future Nix release.
- Define `nbPkgs` under attr `legacyPackages`.
This also has the advantage to make its contents more easily
accessible via the nix CLI. Example:
nix eval nix-bitcoin#nbPkgs.modulesPkgs.clightning.version
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 change is fully backwards compatible.
We continue to use the standard non-flake evaluation mode in our
examples and internal tooling until the flakes design has stabilized.
'clightning-plugins = pkgs.recurseIntoAttrs' in pkgs/default.nix is
needed by flake-utils.lib.flattenTree in flake.nix.
It transforms the packages in `clightning-plugins` to top-level packages
named like `clightning-plugins/summary`. (The flake attr `packages`
must be a non-nested attrset of derivations.)