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
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