Hello all.
Due to a weird setup (proxy restrictions), I have some lab machines with nix daemon:
- with NO access to github (ie no access to fetch the flake input like github:nixos/nixpkgs?rev=…)
- with access to a local binary cache localy managed.
Some other online machines have accesses to fetch (from github) and build the stuff, then push the built packages on the localy managed binary cache. I want then the offline lab machines to be able to build packages only by fetching necessary stuff from the local binary cache.
The main issue with this approach is: how can I make offline nix fetch the flake input from the binary cache ?
When I run the below command,
nix flake metadata “github:nixos/nixpkgs?rev=xxx”
I quickly get the input path /nix/store/hash-source. Is the mapping “flake.input” → “/nix/store/hash-source” stored somewhere ? I don’t see it in flake.lock ?
I might then need to make the /nix/store/hash-source available on offline machine. I have found the “nix flake archive” or “nix copy” which produces NARs, and I could then push these NARs onto the local binary cache. But then, how would the lab machines figure out that to get the “github:nixos/nixpkgs?rev=xxx” input, it should download “/nix/store/hash-source” from the binary cache ?
I hope these questions and this setup are understandable; don’t hesitate to say it if this approach is absolute non-sense or if there are completely different approaches.
If you’re still there, thanks for your time reading ^^