Make dockerTools.buildImageWithNixDb reproducible#289840
Conversation
The loaded database contains timestamps of when the nix paths were registered. Depending on the host store, these can differ between runs. Resetting them to a well known values ensures that the produced image is reproducible.
You can skip nixpkgs-review. The relevant test here is |
|
I was able to dust off an old laptop and run the tests there (i.e. running |
|
Oh, I thought you wanted to add a test case or assertion. |
Description of changes
The loaded database loaded by
dockerTools.buildImageWithNixDbcontains timestamps of when the nix paths were registered. Depending on the host store, these can differ between runs. Resetting them to a well known value ensures that the produced image is reproducible.Related to #289813.
I don't know how to add a test for this. The only thing I can think of is to add a test to https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/docker-tools.nix that reads out the
registrationTimerows from the database and asserts they are whateverSOURCE_DATE_EPOCHgets set to?P.S.: I tried running
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"to test the change, but it seems to overload my local nix VM, so I couldn't test this locally. Since this is my first contribution to nixpkgs, I don't really know what to do about this 😅Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.