Nix flake
Status
Accepted - ADP-983
Context
The DevOps team have contributed a PR which converts the Nix build to the new Nix flake format.
This blog series provides some background information on flakes.
DevOps team also wish to convert Daedalus to use Nix flakes. For this to work well, it's better that Daedalus dependencies such as cardano-wallet are also defined as flakes.
The tl;dr for flakes is that default.nix and shell.nix are deprecated in favour of flake.nix.
You type nix build .#cardano-wallet instead of nix-build -A cardano-wallet and you type nix develop instead of nix-shell.
Decision
Review and merge PR #2997, since flakes seem to be the future and offer some benefits to developers.
This will add a flake.nix file, and replace default.nix, shell.nix, and release.nix with backwards compatibility shims.
- Pay close attention to any broken builds or CI processes which may result from these changes.
- Ensure that the documentation is updated with the new build commands.
- Notify developers that the Nix build files have changed, and they may need to modify the commands which they use.
- After a while, remove
default.nixandshell.nixand associated compatibility code.
Consequences
- Developers and users of the Nix build will now need Nix version 2.4 at least - Nix 2.5 is probably better.
- The
nix buildCLI for building with flakes seems nicer than the oldnix-build. - Apparently,
nix develophas better caching thannix-shell, and so it will be faster to start the dev environment. - The process for updating Nix dependencies (e.g. Haskell.nix) is easier and more sane -
nix flake lock. - Other PRs which are open may need to be rebased on latest
masterfor their CI to pass.