NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.41k stars 13.63k forks source link

nixos-rebuild offline #151548

Open piegamesde opened 2 years ago

piegamesde commented 2 years ago

Is your feature request related to a problem? Please describe. There are a lot of issues around building nix derivations in offline mode, when no dependencies need to be fetched: https://github.com/NixOS/nix/issues/1985 https://github.com/NixOS/nix/issues/2715 https://github.com/NixOS/nix/issues/1195.

As far as I can tell, all the fixes are only concerned with nix-build and nix build. None of them seem to mention nixos-rebuild, so I'm opening this issue.

Describe the solution you'd like If the internet connection fails, but none is actually needed, then the build should not fail.

Describe alternatives you've considered A nixos-rebuild --offline flag

Additional context Workaround: nixos-rebuild switch --option substitute false source

matu3ba commented 2 years ago

Approach for rebuild assumes that no new packages are installed. alternatively, one can use wpa_supplicant flags to connect to wifi (or the ethernet pendant). However that can be very tedious.

related issue of "running nixos-rebuild in a persistent session" https://github.com/NixOS/nixpkgs/issues/3702

matu3ba commented 2 years ago

~~The suggested workaround did not work for me with the latest nixos installer https://channels.nixos.org/nixos-21.11/latest-nixos-plasma5-x86_64-linux.iso (its an older laptop without uefi support) For me the driver was also not correctly setup with wpa_supplicant.~~

was stupid beginners mistake: should have used sudo nixos-install instead of sudo nixos-rebuild switch, since the build iso was booted.