nlewo / nix2container

An archive-less dockerTools.buildImage implementation
Apache License 2.0
501 stars 45 forks source link

Change modification time to be consistent with nix store #141

Closed 3Dcube closed 1 month ago

3Dcube commented 2 months ago

I investigated why my nginx worked fine on my host nixos but not in the container. I found that nginx is patched to better handle files inside the nix store, but one of the condition is that mtime should be 1. I checked /nix/store on my system and yes all files have mtime 1, then I checked /nix/store files inside the container and mtime is 0

https://github.com/NixOS/nixpkgs/blob/194846768975b7ad2c4988bdb82572c00222c0d7/pkgs/servers/http/nginx/nix-etag-1.15.4.patch#L43

After changing modification time from 0 to 1 in the nix2container that patch started to work as expected

nlewo commented 1 month ago

Thank you.

(tests locally passed.)