elitak / nixos-infect

[GPLv3+] install nixos over the existing OS in a DigitalOcean droplet (and others with minor modifications)
GNU General Public License v3.0
1.3k stars 214 forks source link

nix-env errors about using a symlink path #190

Closed jonahbron closed 5 months ago

jonahbron commented 7 months ago

This is the second time I've used Infect on an OCI machine, and this time I encountered a new type of error.

+ nix-env --set -I nixpkgs=/root/.nix-defexpr/channels/nixos/ -f '<nixpkgs/nixos>' -p /nix/var/nix/profiles/system -A system
trace: warning: system.stateVersion is not set, defaulting to 23.05. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion.
trace: warning: The option `boot.cleanTmpDir' defined in `/etc/nixos/configuration.nix' has been renamed to `boot.tmp.cleanOnBoot'.
error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|

       … while evaluating derivation 'nixos-system-instance-20240129-2224-23.05.5533.70bdadeb94ff'
         whose name attribute is located at /nix/store/56727vjqg650ixvq84p7xrwwh93a7cma-nixos-23.05/nixos/pkgs/stdenv/generic/make-derivation.nix:303:7

       … while evaluating attribute 'activationScript' of derivation 'nixos-system-instance-20240129-2224-23.05.5533.70bdadeb94ff'
         at /root/.nix-defexpr/channels/nixos/nixos/modules/system/activation/top-level.nix:112:5:
       (stack trace truncated; use '--show-trace' to show the full trace)

       error: path '/root/.nix-defexpr/channels/nixos' is a symlink

I don't have a clear idea of why this is happening, but did find a workaround. I downloaded the infection script to a file, and then replaced $HOME/.nix-defexpr/channels/nixos in the script with the output of realpath $HOME/.nix-defexpr/channels/nixos. Unclear why it would suddenly start complaining about using a symlink.

jonahbron commented 7 months ago

Uploaded a PR with my solution integrated in the script.

jkarni commented 7 months ago

I also started hitting this, I think only in the past 24 hours. This seems to be the underlying cause.

jonahbron commented 7 months ago

Nice looks like the issue is closed. Maybe this workaround doesn't need to me merged, but idk how long it takes to release the fix