Compare commits

...
Author SHA1 Message Date
aaron e35311dfd5 chore: update installation guide with secure-boot setup pitfalls 2026-10-03 16:21:54 +02:00
aaron beb520a615 feature(boot): add secure-boot support and tpm-unlock to neon 2026-10-03 15:55:36 +02:00
aaron 4eb3e27f8b Merge pull request 'feature(boot): add secure-boot support and tpm-unlock to argon' (#93) from feature/argon_secureboot into main
Reviewed-on: #93
2026-10-03 15:48:06 +02:00
aaron 8c56b00247 feature(boot): add secure-boot support and tpm-unlock to argon 2026-10-03 15:07:13 +02:00
aaron ff2e4d2f69 Merge pull request 'fix: do not allow edits to the bootloader' (#92) from feature/bootloader_security into main
Reviewed-on: #92
2026-10-03 14:11:56 +02:00
aaron 318e17ac27 fix: do not allow edits to the bootloader 2026-10-03 14:11:29 +02:00
aaron c66549f3bf Merge pull request 'feature(hidpi): adapt sddm and systemd-boot to hidpi display' (#91) from feature/krypton_hidpi into main
Reviewed-on: #91
2026-10-03 13:44:31 +02:00
aaron 620c415be9 fix: adapt systemd-boot for kryptons hidpi screen by using the right console mode 2026-10-03 13:39:35 +02:00
aaron 472f359f80 fix: adapt kryptons sddm for hidpi using the qt scale factor 2026-10-03 13:35:50 +02:00
aaron ad494d1209 Merge pull request 'feature(boot): add luks unlock method using TPM+PIN' (#90) from feature/tpm_unlock into main
Reviewed-on: #90
2026-10-03 13:28:35 +02:00
aaron d26bd424cc feature(boot): add luks unlock method using TPM+PIN 2026-10-03 13:25:18 +02:00
aaron a7bba82b5b Merge pull request 'feature(lanzaboote): add support for secure-boot through lanazaboote' (#88) from feature/secure_boot into main
Reviewed-on: #88
2026-10-03 12:48:11 +02:00
aaron a5e69c043d chore: update installation guide with secure-boot setup 2026-10-03 12:47:27 +02:00
aaron b2a2e7d161 Merge remote-tracking branch 'origin/main' into feature/secure_boot 2026-10-03 11:41:27 +02:00
aaron 66a19890bd chore: remove old vm host entry since it is not used anymore (#89)
Reviewed-on: #89
Co-authored-by: aaron <aaron@0x29a.ch>
2026-10-03 11:37:40 +02:00
aaron 450559f8c6 feature: data-drives on argon and boot securty (#87)
- increase security by restricting /boot to root only
- add data-drives for encrypted drives that will get mounted through crypttab rather than the initrd

Reviewed-on: #87
Co-authored-by: aaron <aaron@0x29a.ch>
2026-10-03 10:57:34 +02:00
aaron b75f44ceab feature(lanzaboote): add support for secure-boot through lanazaboote 2026-10-03 10:39:28 +02:00
aaron b42b873eb1 fix(opencl): remove failing legacy build from t14g1 config 2026-10-02 23:47:57 +02:00
aaron 4effe953c8 Merge pull request 'feature: add new host krypton' (#86) from feature/krypton into main
Reviewed-on: #86
2026-10-02 23:28:24 +02:00
aaron 645a4163f5 feature(neon): since nixos-hardware was added, add support for the t14g1 as well 2026-10-02 23:28:05 +02:00
aaron 4845485547 fix: add proper hardware-configuration for the host 2026-10-02 22:40:37 +02:00
aaron ac74b85231 feature(krypton): add framework 13 pro to the list of hosts 2026-10-02 22:01:56 +02:00
aaron 42da578f75 Merge pull request 'Feature/update installation' (#85) from feature/update_installation into main
Reviewed-on: #85
2026-10-02 17:36:42 +02:00
aaron dd50c4b4e5 feature(disk): allow discards on cryptroot 2026-10-02 17:35:53 +02:00
aaron 8a1067b324 feature(trim): add trim support and change partuuid to disk-labels 2026-10-02 17:34:45 +02:00
aaron fc4f0afc46 chore(guide): add corrections and updates to the install guide 2026-10-02 17:33:34 +02:00
aaron 006290ef05 Merge pull request 'feature(boot): attatch /tmp to tmpfs, but keep nix build in /var/tmp' (#84) from feature/tmpfs-tmp into main
Reviewed-on: #84
2026-10-02 16:40:44 +02:00
18 changed files with 483 additions and 327 deletions
+103 -11
View File
@@ -2,8 +2,13 @@
- The installations presented in this repository are always luks encrypted - The installations presented in this repository are always luks encrypted
- For simplicity I'm using device labels rather than uuids - For simplicity I'm using device labels rather than uuids
- Secure Boot has to be disabled in the firmware, the installer iso isn't signed
1. the partitioning layout should look somewhat like this after the installation 1. create the partitions with `cfdisk` or `fdisk` (gpt)
- `nvme0n1p1`: 2G, type `EFI System`, otherwise the firmware won't find the bootloader
- `nvme0n1p2`: the rest, type `Linux filesystem`
the layout should look somewhat like this after the installation
```bash ```bash
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
nvme0n1 259:0 0 476.9G 0 disk nvme0n1 259:0 0 476.9G 0 disk
@@ -30,12 +35,13 @@ cryptsetup luksOpen /dev/nvme0n1p2 cryptroot
pvcreate /dev/mapper/cryptroot pvcreate /dev/mapper/cryptroot
# create a volume group inside # create a volume group inside
vgcreate lvmroot /dev/mapper/cryptroot vgcreate lvmroot /dev/mapper/cryptroot
# create the swap volume # create the swap volume, half the ram (no hibernation)
lvcreate --size 8G lvmroot --name swap lvcreate --size 16G lvmroot --name swap
# if you desire, create a home volume # if you desire, create a home volume
lvcreate --size 150G lvmroot --name home lvcreate --size 150G lvmroot --name home
# create the root volume # create the root volume, leave some space in the vg to grow volumes later
lvcreate -l 100%FREE lvmroot --name root # (lvextend -r -L +50G lvmroot/home works while mounted)
lvcreate -l 90%FREE lvmroot --name root
# format as usual for root partition # format as usual for root partition
mkfs.ext4 -L "nixroot" /dev/mapper/lvmroot-root mkfs.ext4 -L "nixroot" /dev/mapper/lvmroot-root
@@ -47,7 +53,7 @@ mkswap -L "nixswap" /dev/mapper/lvmroot-swap
# mount root # mount root
mount /dev/disk/by-label/nixroot /mnt mount /dev/disk/by-label/nixroot /mnt
# mount boot # mount boot
mount --mkdir /dev/nvme0n1p1 /mnt/boot mount --mkdir /dev/disk/by-label/nixboot /mnt/boot
# again, if you did the home volume # again, if you did the home volume
mount --mkdir /dev/disk/by-label/nixhome /mnt/home mount --mkdir /dev/disk/by-label/nixhome /mnt/home
# turn on swap # turn on swap
@@ -59,8 +65,7 @@ swapon /dev/disk/by-label/nixswap
# generate templates and update the hardware-configuration.nix # generate templates and update the hardware-configuration.nix
nixos-generate-config --root /mnt nixos-generate-config --root /mnt
# add dm-crypt and dm-mod to the kernelModules # no extra kernelModules needed, luks and lvm load dm_crypt and dm_mod themselves
boot.initrd.kernelModules = [ "dm-crypt" "dm-mod" ];
# add file systems using labels # add file systems using labels
fileSystems."/" = fileSystems."/" =
@@ -70,7 +75,7 @@ fileSystems."/" =
fileSystems."/boot" = fileSystems."/boot" =
{ device = "/dev/disk/by-label/nixboot"; { device = "/dev/disk/by-label/nixboot";
fsType = "vfat"; fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ]; options = [ "fmask=0077" "dmask=0077" ]; # only root may read /boot
}; };
fileSystems."/home" = fileSystems."/home" =
{ device = "/dev/disk/by-label/nixhome"; { device = "/dev/disk/by-label/nixhome";
@@ -81,7 +86,13 @@ swapDevices =
]; ];
# point the bootloader to the luks device # point the bootloader to the luks device
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-label/nixcrypt"; boot.initrd.luks.devices."cryptroot" = {
device = "/dev/disk/by-label/nixcrypt";
# without this fstrim never reaches the ssd
allowDiscards = true;
# lower latency on nvme
bypassWorkqueues = true;
};
``` ```
4. install nixos 4. install nixos
@@ -91,8 +102,89 @@ nixos-install
## how to deploy the initial config ## how to deploy the initial config
- Don't forget to install the bootloader, if you changed it since `nixos-install` - Don't forget to install the bootloader, if you changed it since `nixos-install`
- The fresh install has no flakes and no git yet, a temporary shell is enough
- If the installer iso is older than the flake's nixpkgs, `--no-reexec` keeps
`nixos-rebuild` from re-executing a newer version of itself, which can fail
against the older systemd of the fresh install (only needed once)
- Set a password for the user before rebooting, `users.nix` doesn't set one
```bash ```bash
$ sudo nixos-rebuild --install-bootloader switch --flake .#host_name $ export NIX_CONFIG="experimental-features = nix-command flakes"
$ nix-shell -p git
$ sudo nixos-rebuild --install-bootloader boot --flake .#host_name --no-reexec
$ sudo passwd aaron
```
## how to enable secure boot
Secure Boot uses lanzaboote with our own keys, see `modules/nixos/lanzaboote.nix`.
Do this after the initial config is deployed and boots.
1. create the keys, before the first rebuild with the lanzaboote module
```bash
# the keys end up in /var/lib/sbctl, they never leave the host
$ sudo nix run nixpkgs#sbctl -- create-keys
```
2. import `modules/nixos/lanzaboote.nix` in the host's `configuration.nix`, rebuild and check the signatures
```bash
$ sudo nixos-rebuild switch --flake .#host_name
# EFI/Linux/*.efi and the bootloader must be signed, kernels in EFI/nixos
# are not, lanzaboote checks them by hash
$ sudo sbctl verify
```
3. reboot once with Secure Boot still disabled, to make sure the new entries boot
4. in the firmware (F2), erase all Secure Boot keys, then boot nixos again
```bash
# "Setup Mode: ✗ Enabled", the ✗ only means the state is insecure
$ sudo sbctl status
```
5. enroll the keys
```bash
# only our own keys, no microsoft keys
$ sudo sbctl enroll-keys
```
- sbctl refuses if the TPM eventlog shows option ROMs (e.g. a dedicated gpu).
Don't force it, either trust exactly those with `--tpm-eventlog` or
microsoft's keys with `--microsoft`. Without either, the firmware may not
start the device, in the worst case the machine doesn't boot at all.
- Check what sbctl found first, a real option ROM has a PCI device path:
```bash
$ sudo nix shell nixpkgs#tpm2-tools -c tpm2_eventlog /sys/kernel/security/tpm0/binary_bios_measurements | grep -A14 "EV_EFI_BOOT_SERVICES_DRIVER"
```
- Paths starting with `0407` (firmware volume) are drivers from the firmware
itself, not option ROMs (e.g. on the ThinkPad). `--tpm-eventlog` trusts
exactly those, after a firmware update they may need to be enrolled again
(disable Secure Boot, `sbctl enroll-keys --tpm-eventlog`)
- Without an integrated gpu (argon), the gpu's option ROM draws the firmware
setup too, use `--microsoft` there, a refused gpu means no picture at all
6. enable Secure Boot in the firmware and set a firmware password, then check
```bash
$ bootctl status | grep "Secure Boot" # enabled (user)
$ sudo sbctl status # Secure Boot: ✓ Enabled
```
- If it doesn't boot anymore, disabling Secure Boot in the firmware boots as before
- Losing the keys isn't fatal: erase the keys in the firmware and start over at step 1
## how to unlock the disk with the tpm (laptops)
Needs Secure Boot first. The TPM releases the key only with the PIN and while
the Secure Boot state (PCR 7) is unchanged. The passphrase stays as fallback.
1. enroll the TPM with a PIN as an additional key slot
```bash
# asks for the current passphrase, then the new PIN
$ sudo systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=7 --tpm2-with-pin=yes /dev/disk/by-label/nixcrypt
```
2. import `modules/nixos/tpm-unlock.nix` in the host's `configuration.nix`, rebuild and reboot
- If the passphrase is suddenly asked for instead of the PIN, the Secure Boot
state changed. After a firmware update that's expected, otherwise investigate
before typing the passphrase. To re-enroll:
```bash
$ sudo systemd-cryptenroll --wipe-slot=tpm2 --tpm2-device=auto --tpm2-pcrs=7 --tpm2-with-pin=yes /dev/disk/by-label/nixcrypt
``` ```
## how to upgrade the system ## how to upgrade the system
+1 -1
View File
@@ -10,7 +10,7 @@ My personal NixOS configurations.
├── hosts ├── hosts
│ ├── argon # desktop │ ├── argon # desktop
│ ├── neon # laptop │ ├── neon # laptop
│ └── default # test vm │ └── krypton # second laptop
│ ├── configuration.nix # host-specific settings and module imports │ ├── configuration.nix # host-specific settings and module imports
│ ├── hardware-configuration.nix # generated by nixos-generate-config │ ├── hardware-configuration.nix # generated by nixos-generate-config
│ └── niri.nix # host-specific niri settings (outputs, input) │ └── niri.nix # host-specific niri settings (outputs, input)
Generated
+120
View File
@@ -1,5 +1,36 @@
{ {
"nodes": { "nodes": {
"crane": {
"locked": {
"lastModified": 1789760033,
"narHash": "sha256-jtT4yxZpR8seYnlCMMWSSPlFN92zO6ICuZ8pJrmi86k=",
"owner": "ipetkov",
"repo": "crane",
"rev": "73b980519cefc727a5f6cc8e5c0947a2f9be6edd",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1767039857,
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
"owner": "NixOS",
"repo": "flake-compat",
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
@@ -41,6 +72,50 @@
"type": "github" "type": "github"
} }
}, },
"lanzaboote": {
"inputs": {
"crane": "crane",
"nixpkgs": [
"nixpkgs"
],
"pre-commit": "pre-commit",
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1790423250,
"narHash": "sha256-sr4Kfp6yaXUeyKL6n0Y8/ElcR3momIRC20HFc+LF22s=",
"owner": "nix-community",
"repo": "lanzaboote",
"rev": "c1c5edd31802d181c8aa2c71588995d93425d650",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "v1.2.0",
"repo": "lanzaboote",
"type": "github"
}
},
"nixos-hardware": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1790948122,
"narHash": "sha256-fDMYyzY1lI5b8RuCMrvoaIgTeRwNnTG4dNk1ucROlQE=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "0953bb1a609df63013176e3463393f8df993d3ef",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1790689126, "lastModified": 1790689126,
@@ -99,14 +174,59 @@
"type": "github" "type": "github"
} }
}, },
"pre-commit": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": [
"lanzaboote",
"nixpkgs"
]
},
"locked": {
"lastModified": 1789514889,
"narHash": "sha256-PFD1nxptCXJyJoiYO1gf/5Vv43yqGpHtMC6LUhl9/pQ=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "59f4ca0d063a1a3ec722c88b51a33004862e5379",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"home-manager": "home-manager", "home-manager": "home-manager",
"lanzaboote": "lanzaboote",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixvim": "nixvim", "nixvim": "nixvim",
"noctalia": "noctalia" "noctalia": "noctalia"
} }
}, },
"rust-overlay": {
"inputs": {
"nixpkgs": [
"lanzaboote",
"nixpkgs"
]
},
"locked": {
"lastModified": 1789889921,
"narHash": "sha256-aL/ogiN7qZCGeNovS1f9hX73jwYIKb4Pcq6AZm57WtY=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "1fb104a12a8667045559b2575d6d448ae2fbd99b",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": { "systems": {
"flake": false, "flake": false,
"locked": { "locked": {
+9 -1
View File
@@ -11,6 +11,14 @@
url = "github:noctalia-dev/noctalia-shell"; url = "github:noctalia-dev/noctalia-shell";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
lanzaboote = {
url = "github:nix-community/lanzaboote/v1.2.0";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware = {
url = "github:NixOS/nixos-hardware";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = { nixvim = {
url = "github:nix-community/nixvim"; url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@@ -49,9 +57,9 @@
in in
{ {
nixosConfigurations = { nixosConfigurations = {
default = mkHost "default";
neon = mkHost "neon"; neon = mkHost "neon";
argon = mkHost "argon"; argon = mkHost "argon";
krypton = mkHost "krypton";
}; };
}; };
} }
+10 -25
View File
@@ -1,17 +1,7 @@
# argon: desktop with an amd gpu and three luks-encrypted data drives. # argon: desktop with an amd gpu and three luks-encrypted data drives.
# The drives are unlocked in the initrd with keyfiles from /etc/nixos/keys.
{ lib, pkgs, ... }: { pkgs, ... }:
let
# luks name -> partition uuid, mounted at /mnt/<name>
drives = {
data1 = "dfae62cc-bad1-4879-bf9a-461bde833625";
data2 = "8312edae-9247-481b-a313-52a7f848f027";
nvmecache = "2352250e-4ebe-4f9a-bf66-0d4aaa961bd8";
};
key = name: "/etc/nixos/keys/${name}.key";
in
{ {
imports = [ imports = [
../../modules/nixos/appimage.nix ../../modules/nixos/appimage.nix
@@ -19,8 +9,10 @@ in
../../modules/nixos/audio.nix ../../modules/nixos/audio.nix
../../modules/nixos/bootloader.nix ../../modules/nixos/bootloader.nix
../../modules/nixos/certificates.nix ../../modules/nixos/certificates.nix
../../modules/nixos/data-drives.nix
../../modules/nixos/gnupg.nix ../../modules/nixos/gnupg.nix
../../modules/nixos/greetd.nix ../../modules/nixos/greetd.nix
../../modules/nixos/lanzaboote.nix
../../modules/nixos/locales.nix ../../modules/nixos/locales.nix
../../modules/nixos/networking.nix ../../modules/nixos/networking.nix
../../modules/nixos/niri.nix ../../modules/nixos/niri.nix
@@ -32,6 +24,7 @@ in
../../modules/nixos/settings.nix ../../modules/nixos/settings.nix
../../modules/nixos/steam.nix ../../modules/nixos/steam.nix
../../modules/nixos/thunar.nix ../../modules/nixos/thunar.nix
../../modules/nixos/tpm-unlock.nix
../../modules/nixos/users.nix ../../modules/nixos/users.nix
../../modules/nixos/vial.nix ../../modules/nixos/vial.nix
]; ];
@@ -46,20 +39,12 @@ in
}; };
hardware.amdgpu.initrd.enable = true; hardware.amdgpu.initrd.enable = true;
# encrypted data drives # encrypted data drives, see data-drives.nix
boot.initrd.secrets = lib.mapAttrs' (name: _: lib.nameValuePair (key name) (key name)) drives; local.dataDrives = {
boot.initrd.luks.devices = lib.mapAttrs (name: uuid: { data1 = "dfae62cc-bad1-4879-bf9a-461bde833625";
device = "/dev/disk/by-uuid/${uuid}"; data2 = "8312edae-9247-481b-a313-52a7f848f027";
keyFile = key name; nvmecache = "2352250e-4ebe-4f9a-bf66-0d4aaa961bd8";
}) drives; };
fileSystems = lib.mapAttrs' (
name: _:
lib.nameValuePair "/mnt/${name}" {
device = "/dev/mapper/${name}";
fsType = "ext4";
options = [ "nofail" ];
}
) drives;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
amdgpu_top amdgpu_top
+11 -8
View File
@@ -22,32 +22,35 @@
"usb_storage" "usb_storage"
"sd_mod" "sd_mod"
]; ];
boot.initrd.kernelModules = [ "dm-crypt dm-mod" ]; boot.initrd.luks.devices."cryptroot" = {
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-label/nixcrypt"; device = "/dev/disk/by-label/nixcrypt";
allowDiscards = true;
bypassWorkqueues = true;
};
boot.kernelModules = [ ]; boot.kernelModules = [ ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/mapper/lvmroot-root"; device = "/dev/disk/by-label/nixroot";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = { fileSystems."/boot" = {
device = "/dev/disk/by-uuid/AC1C-20EB"; device = "/dev/disk/by-label/nixboot";
fsType = "vfat"; fsType = "vfat";
options = [ options = [
"fmask=0022" "fmask=0077"
"dmask=0022" "dmask=0077"
]; ];
}; };
fileSystems."/home" = { fileSystems."/home" = {
device = "/dev/mapper/lvmroot-home"; device = "/dev/disk/by-label/nixhome";
fsType = "ext4"; fsType = "ext4";
}; };
swapDevices = [ swapDevices = [
{ device = "/dev/mapper/lvmroot-swap"; } { device = "/dev/disk/by-label/nixswap"; }
]; ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
-139
View File
@@ -1,139 +0,0 @@
# 0x29a nixos config
{ pkgs, ... }:
{
# use flakes
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
# configure bootloader
boot.loader.systemd-boot.enable = false;
boot.loader.grub = {
enable = true;
device = "nodev";
efiSupport = true;
};
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelParams = [
"quiet"
"console.ttyS0,115200n8" # allow terminals on serial console
];
# plymouth boot eye candy
boot.initrd.systemd.enable = true;
boot.plymouth.enable = true;
boot.plymouth.theme = "spinner";
# use latest kernel
boot.kernelPackages = pkgs.linuxPackages_latest;
# guest agent for proxmox
services.qemuGuest.enable = true;
# networking
networking.hostName = "nixos";
networking.networkmanager.enable = true;
# time zone.
time.timeZone = "Europe/Amsterdam";
# select internationalisation properties
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
console = {
font = "Lat2-Terminus16";
keyMap = "de_CH-latin1";
};
# window manager configs
services.xserver = {
enable = true;
xkb.layout = "ch";
xkb.options = "eurosign:e,caps:escape";
windowManager.qtile = {
enable = true;
extraPackages =
python3Packages: with python3Packages; [
qtile-extras
];
};
};
environment.pathsToLink = [ "/libexec" ];
environment.variables.EDITOR = "vim";
# enable sound
services.pipewire = {
enable = true;
pulse.enable = true;
};
# define a user account
users.users.aaron = {
isNormalUser = true;
group = "users";
extraGroups = [ "wheel" ];
shell = pkgs.zsh;
packages = with pkgs; [
tree
fastfetch
];
};
# browser
programs.firefox.enable = true;
# zsh config
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestions.enable = true;
ohMyZsh = {
enable = true;
plugins = [
"git"
"sudo"
];
theme = "agnoster";
};
};
# system packages
environment.systemPackages = with pkgs; [
vim
neovim
git
ghostty
kitty
wget
gnupg
];
# Some programs need SUID wrappers
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# enable the OpenSSH daemon
services.openssh.enable = true;
# firewall configs
networking.firewall.allowedTCPPorts = [ 22 ];
# networking.firewall.allowedUDPPorts = [ ... ];
# install state version
system.stateVersion = "25.05"; # Don't change
}
-60
View File
@@ -1,60 +0,0 @@
# 0x29a nixos hardware configuration
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
# boot and initrd configs
boot.initrd.availableKernelModules = [
"uhci_hcd"
"ehci_pci"
"ahci"
"virtio_pci"
"virtio_scsi"
"sd_mod"
"sr_mod"
];
boot.initrd.kernelModules = [
"dm-snapshot"
"cryptd"
];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-label/nixcrypt";
# file systems
fileSystems."/" = {
device = "/dev/disk/by-label/nixroot";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/nixboot";
fsType = "vfat";
options = [
"fmask=0022"
"dmask=0022"
];
};
fileSystems."/home" = {
device = "/dev/disk/by-label/nixhome";
fsType = "ext4";
};
swapDevices = [
{ device = "/dev/disk/by-label/nixswap"; }
];
# enable dhcp on all interfaces
networking.useDHCP = lib.mkDefault true;
# set host arch
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}
-79
View File
@@ -1,79 +0,0 @@
{ pkgs, ... }:
{
# user config
home.username = "aaron";
home.homeDirectory = "/home/aaron";
# packages
home.packages = with pkgs; [
fastfetch
zip
xz
unzip
p7zip
jq
mtr
iperf3
dnsutils
ldns
socat
nmap
cowsay
file
which
tree
zstd
gnupg
btop
iotop
iftop
strace
lsof
sysstat
lm_sensors
ethtool
pciutils
usbutils
];
# configure git
programs.git.settings = {
enable = true;
userName = "aaron";
userEmail = "aaron@0x29a.ch";
};
programs.zsh = {
enable = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
oh-my-zsh = {
enable = true;
plugins = [
"git"
"sudo"
"python"
"ansible"
];
theme = "agnoster";
};
};
## deploy qtile config
#home.file."qtile-config" = {
# target = ".config/qtile/config.py";
# source = "${inputs.qtile-config}/qtile_config/config.py";
# force = true;
#};
home.sessionVariables = {
EDITOR = "vim";
};
# enable home manager
programs.home-manager.enable = true;
# don't change
home.stateVersion = "25.05";
}
+44
View File
@@ -0,0 +1,44 @@
# krypton: framework 13 pro, intel core ultra x7 358H
{ inputs, ... }:
{
imports = [
inputs.nixos-hardware.nixosModules.framework-intel-core-ultra-series3
../../modules/nixos/appimage.nix
../../modules/nixos/astro.nix
../../modules/nixos/audio.nix
../../modules/nixos/bootloader.nix
../../modules/nixos/certificates.nix
../../modules/nixos/docker.nix
../../modules/nixos/gnupg.nix
../../modules/nixos/lanzaboote.nix
../../modules/nixos/locales.nix
../../modules/nixos/networking.nix
../../modules/nixos/niri.nix
../../modules/nixos/noctalia.nix
../../modules/nixos/openssh.nix
../../modules/nixos/packages.nix
../../modules/nixos/protonvpn.nix
../../modules/nixos/sddm.nix
../../modules/nixos/services.nix
../../modules/nixos/settings.nix
../../modules/nixos/steam.nix
../../modules/nixos/tpm-unlock.nix
../../modules/nixos/users.nix
../../modules/nixos/vial.nix
];
# host-specific niri config (input devices, laptop binds)
home-manager.users.aaron.imports = [ ./niri.nix ];
# hidpi panel (2880x1920): the sddm greeter runs in weston, which doesn't scale
services.displayManager.sddm.settings.General.GreeterEnvironment = "QT_SCALE_FACTOR=2";
# bigger boot menu font, mode found with "r" in the menu; mode 6 is beyond
# what boot.loader.systemd-boot.consoleMode accepts, so set via lanzaboote
boot.lanzaboote.settings.console-mode = "6";
networking.hostName = "krypton";
system.stateVersion = "26.05"; # don't change
}
+60
View File
@@ -0,0 +1,60 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.initrd.luks.devices."cryptroot" = {
device = "/dev/disk/by-label/nixcrypt";
allowDiscards = true;
bypassWorkqueues = true;
};
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-label/nixroot";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/nixboot";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
fileSystems."/home" = {
device = "/dev/disk/by-label/nixhome";
fsType = "ext4";
};
swapDevices = [
{ device = "/dev/disk/by-label/nixswap"; }
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.cpu.intel.npu.enable = true;
}
+24
View File
@@ -0,0 +1,24 @@
# krypton: framework 13 laptop, the built-in display is auto-configured by niri
{ lib, ... }:
{
wayland.windowManager.niri.settings = {
input.touchpad = {
tap = { };
natural-scroll = { };
};
layout.gaps = lib.mkForce 10;
binds = {
"Print".screenshot = { };
"Ctrl+Print".screenshot-screen = { };
"Mod+Shift+P".power-off-monitors = { };
# finer brightness steps
"XF86MonBrightnessUp".spawn-sh = lib.mkForce "brightnessctl --class=backlight set +1%";
"XF86MonBrightnessDown".spawn-sh = lib.mkForce "brightnessctl --class=backlight set 1%-";
};
};
}
+22
View File
@@ -1,5 +1,15 @@
# neon: thinkpad t14 gen1 (intel)
{
inputs,
lib,
pkgs,
...
}:
{ {
imports = [ imports = [
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t14-intel-gen1
../../modules/nixos/appimage.nix ../../modules/nixos/appimage.nix
../../modules/nixos/astro.nix ../../modules/nixos/astro.nix
../../modules/nixos/audio.nix ../../modules/nixos/audio.nix
@@ -7,6 +17,7 @@
../../modules/nixos/certificates.nix ../../modules/nixos/certificates.nix
../../modules/nixos/docker.nix ../../modules/nixos/docker.nix
../../modules/nixos/gnupg.nix ../../modules/nixos/gnupg.nix
../../modules/nixos/lanzaboote.nix
../../modules/nixos/locales.nix ../../modules/nixos/locales.nix
../../modules/nixos/networking.nix ../../modules/nixos/networking.nix
../../modules/nixos/niri.nix ../../modules/nixos/niri.nix
@@ -18,6 +29,7 @@
../../modules/nixos/services.nix ../../modules/nixos/services.nix
../../modules/nixos/settings.nix ../../modules/nixos/settings.nix
../../modules/nixos/steam.nix ../../modules/nixos/steam.nix
../../modules/nixos/tpm-unlock.nix
../../modules/nixos/users.nix ../../modules/nixos/users.nix
../../modules/nixos/vial.nix ../../modules/nixos/vial.nix
]; ];
@@ -25,6 +37,16 @@
# host-specific niri config (input devices, laptop binds) # host-specific niri config (input devices, laptop binds)
home-manager.users.aaron.imports = [ ./niri.nix ]; home-manager.users.aaron.imports = [ ./niri.nix ];
# nixos-hardware's intel module adds intel-compute-runtime-legacy1 (opencl),
# which isn't cached and currently fails to build; not needed on neon
hardware.graphics.extraPackages = lib.mkForce (
with pkgs;
[
intel-media-driver
vpl-gpu-rt
]
);
networking.hostName = "neon"; networking.hostName = "neon";
system.stateVersion = "25.11"; # don't change system.stateVersion = "25.11"; # don't change
} }
+7 -3
View File
@@ -25,7 +25,11 @@
"dm-snapshot" "dm-snapshot"
"cryptd" "cryptd"
]; ];
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-label/nixcrypt"; boot.initrd.luks.devices."cryptroot" = {
device = "/dev/disk/by-label/nixcrypt";
allowDiscards = true;
bypassWorkqueues = true;
};
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
@@ -39,8 +43,8 @@
device = "/dev/disk/by-label/nixboot"; device = "/dev/disk/by-label/nixboot";
fsType = "vfat"; fsType = "vfat";
options = [ options = [
"fmask=0022" "fmask=0077"
"dmask=0022" "dmask=0077"
]; ];
}; };
+2
View File
@@ -4,6 +4,8 @@
# set bootloader to systemd # set bootloader to systemd
boot.loader = { boot.loader = {
systemd-boot.enable = true; systemd-boot.enable = true;
# no kernel command line editing at the boot menu (e.g. init=/bin/sh)
systemd-boot.editor = false;
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
}; };
+37
View File
@@ -0,0 +1,37 @@
# luks-encrypted data drives, unlocked after boot via /etc/crypttab with
# keyfiles from /etc/nixos/keys/<name>.key on the encrypted root.
# Not in boot.initrd.luks on purpose: keyfiles there end up in the initrd
# on the unencrypted /boot.
{ config, lib, ... }:
let
drives = config.local.dataDrives;
in
{
options.local.dataDrives = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = { };
example = {
data1 = "dfae62cc-bad1-4879-bf9a-461bde833625";
};
description = "luks name -> luks partition uuid, mounted at /mnt/<name>";
};
config = lib.mkIf (drives != { }) {
environment.etc.crypttab.text = lib.concatStrings (
lib.mapAttrsToList (
name: uuid: "${name} /dev/disk/by-uuid/${uuid} /etc/nixos/keys/${name}.key luks,discard,nofail\n"
) drives
);
fileSystems = lib.mapAttrs' (
name: _:
lib.nameValuePair "/mnt/${name}" {
device = "/dev/mapper/${name}";
fsType = "ext4";
options = [ "nofail" ];
}
) drives;
};
}
+25
View File
@@ -0,0 +1,25 @@
# Secure Boot with lanzaboote. systemd-boot stays the bootloader, but lanzaboote
# installs it signed and writes signed boot entries instead of the nixos module.
# The keys are created once per host with `sudo sbctl create-keys` before the
# first rebuild, and enrolled into the firmware with `sbctl enroll-keys`.
{
inputs,
lib,
pkgs,
...
}:
{
imports = [ inputs.lanzaboote.nixosModules.lanzaboote ];
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.lanzaboote = {
enable = true;
pkiBundle = "/var/lib/sbctl";
};
# key management and verification
environment.systemPackages = [ pkgs.sbctl ];
}
+8
View File
@@ -0,0 +1,8 @@
# Unlock cryptroot with the TPM and a PIN, the passphrase stays as fallback.
# The TPM only releases the key while PCR 7 (the Secure Boot state) matches,
# so this needs lanzaboote.nix. Enrolled once per host with
# `systemd-cryptenroll`, see INSTALLATION.md.
{
boot.initrd.luks.devices."cryptroot".crypttabExtraOpts = [ "tpm2-device=auto" ];
}