I can't fix things if i have no internet connection

i have made changes to /ext/nixos/hardware…

but when i run nixos rebuild with switch, the changes are not made

and i can’t get into the system

1 Like

There is a --offline flag which will let you get past that. If you haven’t garbage collected build-time-only dependencies that are required to build something you’ve removed in the new generation, you should be able to rebuild from there. Otherwise, you may need to temporarily comment some stuff out to get things going.

Keep in mind that you can also always run an older generation if the reason you can’t go online is a configuration change.

If the reason you can’t go online is that you use nixos-rebuild to add new wifi settings and such, consider using networkmanager so that you can configure networking at runtime. For your average desktop system, relying purely on networking.wireless.networks without a proper runtime network management service doesn’t make sense.

i think you are giving me a solution

but not telling me how i implement it

for instance, i’m posting from debian

nixos-rebuild boot --use-remote-sudo --offline and reboot.

Ah, hum, sorry, looks like --offline is part of the v3 CLI. You need:

nixos-rebuild boot --sudo --option substitute false

Yes, you’re definitely stuck. Seems it wants to rebuild gcc - you must have a pretty big difference between what you want to switch to and what is already installed for that to happen.

You’ve not told us why you can’t get an internet connection yet, but assuming there is no way to do that, and previous generations don’t have a working config, no way out but to boot up the live ISO, get an internet connection, enter your OS with nixos-enter and then rebuild from there.

the problem occurs at boot i’m guessing before network-manager kicks in

i made a change hardware-configuartion.nix where i put /dev/dis instead of /dev/disk

also it’s meant to mount a cifs drive which it now seems to fail to do (possibly because of network-manager not loaded yet?)

there’s also the added problem that the wifi is sometimes not picked up until a 2nd boot

Right, have you tried booting into an older generation? If you hold space on boot it should give you options.

nixos-generate-config will regenerate hardware-configuartion.nix

If that’s not enough you can install NixOS again and set the installer to keep your current home folder (if it’s in another partition than /), then rebuild from your current configuration (which you must backup)

That won’t help as long as nixos-rebuild doesn’t build anything.

Booting an older generation would be the first step, but if that fails reinstalling NixOS isn’t necessary either, just use nixos-enter and nixos-rebuild from there.

that’s gone and removed all other mountpoints except for / and /boot

/etc/fstab still has the old the mount points

eventually got it to an internet connection. booted using the nixos install disk and chroot in:

history

1  mount /dev/sdb2 /mnt
2  mount -o bind /dev /mnt/dev
3  mount -o bind /proc /mnt/proc
4  mount -o bind /sys /mnt/sys
5  mount /dev/nvme0n1p1 /mnt/boot
6  chroot /mnt /nix/var/nix/profiles/system/activate
7  chroot /mnt /run/current-system/sw/bin/bash
8  cp /etc/resolv.conf /mnt/etc/
9  chroot /mnt /run/current-system/sw/bin/bash

however that gives - output in pastebin

Use the nixos-enter script instead of hand-chrooting. It properly executes the activation script for you.

thanks. will remember that in the future

–option sandbox false worked this time