3 ms·
This is an important NixOS Flake example. Why? Because it contains the following code/technique: # You can also use a specific git commit hash to lock the ve
by peter_d_sherman 3y ago
This is an important NixOS Flake example.
Why?
Because it contains the following code/technique:
# You can also use a specific git commit hash to lock the version
nixpkgs-fd40cef8d.url = "github:nixos/nixpkgs/fd40cef8d797670e203a27a91e4b8e6decf0b90c";
Why is that important?
Because (as opposed to a construct like:
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
OR
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"
) -- nixpkgs-fd40cef8d.url truly is fixed/pinned/unchangeable/static/"set in stone"/"guaranteed to contain exactly the same code at every point in time"/"locked" (use whatever terminology you will).
Whereas nixos-unstable is always changing, and nixos-23.05, while reasonably stable -- is not guaranteed to be exactly the same code in the future (bug fixes and patches may be applied to it retroactively).
But, "github:nixos/nixpkgs/fd40cef8d797670e203a27a91e4b8e6decf0b90c" is always guaranteed (by means of the commit hash) to be exactly the same code, perpetually and always, into the future, continually...
So, it's a great technique for software hermeticism and reproducibility and container deployments / build recipes.
(In the Flake example above, we also see nixpkgs/nixos-23.05 and nixpkgs/nixos-unstable used as additional Flake inputs. NixOS Flakes support this -- but if hermeticism and reproducability are desired, then only a single nixpkgs.url tied to a specific commit hash via the URL technique shown above, would be used...)
- n8henrie 3y agoYour `flake.lock` will have the specific revision as well, even if you're using unstable or a release URL, so as long as this is getting checked into git then you have reproducibility that way as well.