Konubinix' opinionated web of thoughts

Pinning Nixpkgs

Fleeting

pinning nixpkgs

Nix expression is not fully reproducible. The <nixpkgs> reference is set from the local $NIX_PATH environment variable. In most cases, this is set at the time Nix is installed to the nixpkgs-unstable channel, and therefore it is likely to differ from machine to machine.

https://nixos.org/guides/towards-reproducibility-pinning-nixpkgs.html

The simplest way to do this is to fetch the required nixpkgs version as a tarball specified via the relevant git commit hash: { pkgs ? import (fetchTarball “https://github.com/NixOS/nixpkgs/archive/3590f02e7d5760e52072c1a729ee2250b5560746.tar.gz”) {} }:

https://nixos.org/guides/towards-reproducibility-pinning-nixpkgs.html

, niv is made for exactly that. Niv itself is available in nixpkgs so using it is simple: $ nix-shell -p niv –run “niv init

https://nixos.org/guides/towards-reproducibility-pinning-nixpkgs.html

You can use the generated nix/sources.nix with a top-level default.nix: { sources ? import ./nix/sources.nix , pkgs ? import sources.nixpkgs {} }:

https://nixos.org/guides/towards-reproducibility-pinning-nixpkgs.html