Original discussion
When I run script ./maintainers/scripts/haskell/regenerate-transitive-broken-packages.sh (and thus regenerate-hackage-package.sh) it results in the following error:
error: access to absolute path '/nix/var/nix/profiles/per-user/root/channels-2-link' is forbidden in restricted mode
This error comes from the nix-instantiate line. I believe this is due to my NIX_PATH environment variable. Even in the script's Nix shell (I put echo $NIX_PATH into the script to debug), I see my NIX_PATH as:
nixpkgs=flake:nixpkgs:/nix/var/nix/profiles/per-user/root/channels
Another person was unable to reproduce my error.
I can make the command work by tacking on NIX_PATH=nixpkgs=. nix-instantiate <command> but given someone couldn't reproduce my error, I raised this issue.
If the script works fine for you: what is your NIX_PATH?
I am on WSL2, using a flake and home-manager. Attached is my config.
configuration-redacted.nix.txt
flake-redacted.nix.txt
home-redacted.nix.txt