math-comp / mcb

Mathematical Components (the Book)
Other
139 stars 25 forks source link

Add Nix flake #139

Closed siraben closed 2 years ago

siraben commented 2 years ago
$ NIXPKGS_ALLOW_UNFREE=1 nix build github:siraben/mcb/flake --impure
siraben commented 2 years ago

@gares ping

gares commented 2 years ago

Sorry I missed this PR. I don't know what flake is, any pointer is welcome. One thing that is a bit scary is the --experimental-features flag, if the code you wrote breaks because of this feature being experimental, I won't be able to fix it since I'm no nix expert.

siraben commented 2 years ago

Flakes are in stable Nix (just not currently enabled by default hence the flag.) The main purpose it solves is making sure builds are hermetic and giving a standard interface to compose Nix projects. It's also backwards compatible with previous Nix versions (via https://github.com/edolstra/flake-compat/), so non-flakes users can continue using it fine. From a maintenance perspective the only command to run is nix flake update to keep the nixpkgs commit recent.

siraben commented 2 years ago

Note that the previous usage of Nix in this repository had an impure reference with import <nixpkgs> {}; so this also improves reproducibility.

siraben commented 2 years ago

Thanks!