My device-agnostic Nix OS configuration.
Do not clone directly into /etc/nixos
. This is annoying due to having to
call sudoedit
.
nix-channel --add nixos https://nixos.org/channels/nixos-24.11 nixos
sudo nix-channel --add nixos https://nixos.org/channels/nixos-24.11 nixos
sudo nix-channel --update
On upgrades, just run the same with whatever channels is mentioned in the main config file.
- Edit files in this repository
- Sync to
/etc/nixos/
by runningsudo ./sync.sh
- Rebuild via
sudo nixos-rebuild switch
The hardware configuration is spread across files.
Hierarchy:
hardware-configuration.nix
Contains generic configuration.
hardware-<device-type>.nix
Contains device specific configuration and imports the generic configuration.
hardware-config-import.nix
Decides which hardware specific configuration is imported and isn't tracked by git. This file is then imported by
configuration.nix
.
Since the concrete hardware configurations most likely use community provided defaults, install the given channel:
sudo nix-channel --add https://github.com/NixOS/nixos-hardware/archive/master.tar.gz nixos-hardware
sudo nix-channel --update
To add a new machine, check out the repo and create the
hardware-config-import.nix
and decide whether you need a new device specific
configuration or import the generic one.
The file looks like this:
{ config, ... }:
{
imports = [ ./hardware-thinkpad-l570.nix ];
}
For the concrete hardware configuration, you'll also have to specify the
filesystem. For this, you need the UUID of the drives. You can list the UUIDs
via ls /dev/disk/by-uuid
.
Then add the following section:
fileSystems."/" =
{ device = "/dev/disk/UUID";
fsType = "ext4";
};
- IntelliJ doesn't automatically find the JDK22, the workaround for now is manual installation via IntelliJ, even though this will duplicate the JDK.