I’m very much a NixOS noob, and have hacked together a working config from several sources, and have flakes and home manager enabled (but don’t really use HM properly…). There are a few things I’d like some help on:
- I want to run everything on the unstable channel. Always. My machine is not used for any critical work, and I’d like to keep a rolling release.
- I think I have redundant bits of config, like trying to use HM as a module, and separately at the same time. I need help on how to make it just a module (combine home.nix and flakes).
- Upon booting, I have a ton of generations available, and the kernel version is not the latest. Except in an older generation. I thought I had it configured to only keep some recent generations, and use the latest kernel.
The command I use to update is:
sudo nixos-rebuild switch --upgrade-all -I nixos-config=/home/microbass/src/my-nix-config/configuration.nix
That command seems to update my system to the latest kernel, but removes my flake stuff, and doesn’t implement my home.nix
I’d like to have a command to update everything at once. If I run this, my system uses older kernel, but implements my flake and home.nix:
sudo nixos-rebuild switch --upgrade-all -I nixos-config=/home/microbass/src/my-nix-config/configuration.nix --flake ~/src/my-nix-config/.#microbass
Thanks for looking, and any help taking care of this mess is appreciated!
That’s not using flakes. To use flakes, you’d do:
nixos-rebuild switch --flake /home/microbass/src/my-nix-config#<hostname>
<hostname> can be omitted if your configuration name is the same as your hostname.
You can also use the
--use-remote-sudo flag instead of calling the whole thing as root, then you don’t end up touching your user’s home dir with root permissions.
To update flakes, you need to get nix to update the
flake.lock, which you do by going to the directory and running
nix flake update. There’s no way to do that with one
nixos-rebuild command to my knowledge.
--upgrade-all will update your system channels instead. When using flakes, you don’t need channels at all (and it’s probably best to avoid them, given they’re a common footgun as the only non-declarative part of a NixOS system).
Presumably half your issues stem from being confused about flakes/channels and therefore installing very different versions of things all the time…
If you use grub, NixOS will by default keep 100 generations (and kernels) around, if you use systemd-boot an infinite number of them. This will also fill up your boot directory rapidly. I’d recommend tweaking the
Maybe solve those two issues first and then come back with a separate thread around all the other things you’re asking help with; keeping stuff focused will make it easier to actually resolve stuff.
Thanks for the help!
Adding in the systemd configurationLimit worked like a charm, as did
nixos-rebuild switch --use-remote-sudo --flake /home/microbass/src/my-nix-config#<hostname>