Nix install script not allowed to set env variables

I got this error on my work laptop:

~~> Installing Nix

---- sudo execution ------------------------------------------------------------
I am executing:

    $ sudo cp -RPp ./store/026hln0aq1hyshaxsdvhg0kmcm6yf45r-zlib-1.2.13 ./store/1f3pdcihv4mmgfsyw4jxqjvn7j5sc2xy-aws-c-mqtt-0.7.13 ./store/20d2d0jap81kxp5ng1igl7kkgnd077f3-libcpuid-0.6.2 ./store/34xlpp3j3vy7ksn09zh44f1c04w77khf-libunistring-1.0 ./store/3j1h6psl4pzn6b3yck6rk33bpwrmihb1-aws-c-common-0.8.5 ./store/3n9vwzn9wkq7cj93jp0s6gqpx1zbhvlj-libarchive-3.6.1-lib ./store/3rj4dwafjii1wi2f5va26hindims9zyz-boehm-gc-8.2.2 ./store/3z091ijyij0mmgi3iv0mp945lm2bx4wy-aws-checksums-0.1.13 ./store/4mxnw95jcm5a27qk60z7yc0gvxp42b9a-openssl-3.0.7 ./store/4nlgxhb09sdr51nc9hdm8az5b08vzkgx-glibc-2.35-163 ./store/4rkhsf7sig2lh303bygqr3ph5mfwz0ah-s2n-tls-1.3.28 ./store/50si0kkawnfkgs8m7d8iv2zmkq0fdbm7-aws-c-event-stream-0.2.15 ./store/5glq0q102jva5p0h9ap0f1j9ps24gcc0-aws-sdk-cpp-1.9.294 ./store/5mh5019jigj0k14rdnjam1xwk5avn1id-libidn2-2.3.2 ./store/5q73izqsdasz81gma1nz6870b6220vkh-aws-crt-cpp-0.18.9 ./store/6qqybxxz6636jymz8x7l2sxj4np9yzsy-aws-c-cal-0.5.20 ./store/7b943a2k4amjmam6dnwnxnj8qbba9lbq-busybox-static-x86_64-unknown-linux-musl-1.35.0 ./store/7q41sbf04qcwv75j5bxis6pfjnmshy44-acl-2.3.1 ./store/816qwr4xy058451rbxr0ccyh1v1akhb6-keyutils-1.6.3-lib ./store/84px25a6dsmdg7ni7186rmkybq1k2vrf-aws-c-s3-0.1.51 ./store/9iy1ng7h1l6jdmjk157jra8n4hkrfdj1-brotli-1.0.9-lib ./store/9x6jfl84234im3f4gsrl1js3zyqz76jd-nlohmann_json-3.11.2 ./store/a6q74vrxbsrmmw1z0fdzd0qrcm6dc0ll-aws-c-http-0.6.27 ./store/b7ac47isdc4z1ajln6adz3ppcjs1708b-libsodium-1.0.18 ./store/ba4f8msp39cfvfpw3m7fsalb4psw347z-nss-cacert-3.83 ./store/bwsyv47ri47ppr4ga34wd2khk89ch4n4-aws-c-auth-0.6.21 ./store/c8byvs0rj8vg5cpm5mswcg5dvp7d5ir7-libseccomp-2.5.4-lib ./store/cr5fmwri3601s7724ayjvckhsg6cz4rv-attr-2.5.1 ./store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16 ./store/f116ly4fl72zc5ynb03qrwdk2bp8y61p-aws-c-io-0.13.11 ./store/fph0r1qjhsygrb420y2zsfhjh3rssq0z-aws-c-sdkutils-0.1.7 ./store/h5slhj7gqpqh5q4jb00xdbcwbl8vqqa7-libxml2-2.10.3 ./store/il7dydwf1wfn9b4p4cii8q99b93i106n-editline-1.17.1 ./store/jpj9lx0p2h1vs3gkzj8jh350113bsm84-sqlite-3.39.4 ./store/mc43d38fibi94pp5crfwacl5gbslccd0-nix-2.13.3 ./store/mdck89nsfisflwjv6xv8ydj7dj0sj2pn-gcc-11.3.0-lib ./store/qz400bwshaqikj5s2qyvh0c9qffgmqik-nghttp2-1.49.0-lib ./store/r7gl900my2fw6k33nxh2r7rzv8nv0s25-libkrb5-1.20 ./store/rirzp6ijbcwnxlf0b2n286n587r3z9jw-curl-7.86.0 ./store/vqq9s0d6fw6kqf3sr5nrzqbys9rhygqd-libssh2-1.10.0 ./store/w10in9diaqrcqqxi5lg20n3q2jfpk6pq-zstd-1.5.2 ./store/w3sdhqiazzp4iy40wc2g85mv0grg1cx0-xz-5.2.7 ./store/wnxn8173p8gj888wwgv2l9czp7zf4jl3-aws-c-compression-0.2.16 ./store/ysl6qj5r7nn63b16954dhk7x47r5yq7i-bzip2-1.0.8 /nix/store/

to copy the basic Nix files to the new store at /nix/store


---- sudo execution ------------------------------------------------------------
I am executing:

    $ sudo chmod -R ugo-w /nix/store/

to make the new store non-writable at /nix/store

      Alright! We have our first nix at /nix/store/mc43d38fibi94pp5crfwacl5gbslccd0-nix-2.13.3

---- sudo execution ------------------------------------------------------------
I am executing:

    $ sudo HOME=/root /nix/store/mc43d38fibi94pp5crfwacl5gbslccd0-nix-2.13.3/bin/nix-store --load-db

to load data for the first time in to the Nix Database

dzdo: sorry, you are not allowed to set the following environment variables: HOME

---- oh no! --------------------------------------------------------------------
Oh no, something went wrong. If you can take all the output and open
an issue, we'd love to fix the problem so nobody else has this issue.

:(

We'd love to help if you need it.

You can open an issue at
https://github.com/NixOS/nix/issues/new?labels=installer&template=installer.md

Or get in touch with the community: https://nixos.org/community

Looks like this traces back to a recent-ish change in Set `HOME` var to `root`'s home when running `nix-store` as `root` by virusdave · Pull Request #6980 · NixOS/nix · GitHub.

I’m not familiar with dzdo and whatever corporate controls it may be applying, so I don’t know if the sudo -H suggestion in Set `HOME` var to `root`'s home when running `nix-store` as `root` by virusdave · Pull Request #6980 · NixOS/nix · GitHub would improve the situation or not.

I ended up using the determinate nix installer and was able to get a working setup, after manually cleaning up the partial progress made by the official installer.