NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.08k stars 14.13k forks source link

nixos-rebuild: switching not working with run0 #331484

Open pimeys opened 3 months ago

pimeys commented 3 months ago

Describe the bug

You can't switch to a new configuration by using run0.

Steps To Reproduce

Steps to reproduce the behavior:

  1. run0 nixos-rebuild switch
  2. Failure:
❯ run0 nixos-rebuild switch
/run/current-system/sw/bin/nixos-rebuild: line 198: sudo: command not found

Expected behavior

A new system configuration is built and switched successfully.

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.10.2, NixOS, 24.11 (Vicuna), 24.11.20240728.52ec9ac`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.5`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/store/bcghcr9qwqmanpds017w75mcqda4fgab-source`

Add a :+1: reaction to issues you find important.

deviantsemicolon commented 3 months ago

getting the same bug as well :/

chewblacka commented 2 months ago

Just tried this and run0 nixos-rebuild switch seems to work now for me by and large. The only extra error I get is:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

Other than that it seems to work as expected.

nadevko commented 1 month ago
run0 nixos-rebuild switch

gives

error:
       … <borked>

         at «none»:0: (source not available)

       … while calling the 'import' builtin

         at «string»:1:6:

            1| with import <nixpkgs/nixos> {}; config.system.build.nixos-rebuild
             |      ^

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
building Nix...
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
error: file 'nixpkgs/nixos/modules/installer/tools/nix-fallback-paths.nix' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)

But with plain pkexec all fine.