Is it possible to use rewriteURL system-wide?

It seems I can use rewriteURL in a flake like this:

pkgs = import nixpkgs {
    inherit system;
    config = {
        rewriteURL = url: "http://my_ip/cache/${url}";
    };
};

but is it possible to set in nix.conf or something like that and have it used system-wide?

Thanks.

# ~/.config/nixpkgs/config.nix
{
  rewriteURL = url: "http://my_ip/cache/${url}";
}

See https://nixos.org/manual/nixpkgs/stable/#chap-packageconfig

Of course, this will only work in impure mode, and only applies to nixpkgs instances, and only for that user.

3 Likes