Looking for some guidance/input on how to fetchzip from private file share.
We’ve read thru this thread “How to fetchurl with credentials” and the “Enterprise Wiki”, which outlines how to fetch content from private file shares by setting up a ‘/etc/nix/netrc’ with proper machine and credentials for fetchurl.
We’re assuming the same approach should function work for ‘fetchzip’?
Our use case differs slightly from the how-to described in the “Enterprise Wiki”, which outlines the manual steps for setting up the ‘/etc/nix/netrc’ and ‘/etc/nix/nix.conf’ files whereas we’d like to achieve the same automatically via our ‘configuration.nix’ (i.e. nixos-rebuild switch).
Is there a way to automatically generate the ‘/etc/nix/netrc’ and update the /etc/nix/nix.conf’ (netrc-file = /etc/nix/netrc)?
We understand that secrets (user/pass or security tokens) will need to be placed inside our configuration.nix or similar.
Firstly, do not just simply place tokens in configuration.nix. This will cause nix to copy them into the world readable nix store, which makes things very much not secret.
nix.conf can of course just be edited with the NixOS option for it: nix.settings. If you use this the netrc file doesn’t really need to be in /etc/nix/netrc either, you can just use it from the store with pkgs.writeText or such.
@TLATER Thanks for the feedback. We’ll take a look at your recommendations. We knew there had to be a better ‘nixify’ means of addressing our use case. Encrypting/decrypting secrets sounds like a viable approach.