Add disko with LUKS encryption and impermanence setup

This commit is contained in:
Your Name
2026-08-13 20:03:18 +00:00
parent ac0a706f1c
commit 8e093d75ef
7 changed files with 89 additions and 33 deletions
+1
View File
@@ -19,6 +19,7 @@
./wireguard.nix
./persistence.nix # impermanence: what to keep once "/" is wiped on boot
./usbguard.nix
./disko.nix
./secrets
# You should let those lines as is
+56
View File
@@ -0,0 +1,56 @@
{
disko.devices = {
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"size=12G"
"mode=755"
];
};
};
disk = {
boot = {
type = "disk";
device = "/dev/disk/by-uuid/5251-9B85";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = ["fmask=0077" "dmask=0077"];
};
};
nixos = {
type = "disk";
device = "/dev/disk/by-uuid/e3110976-78ee-4868-94c4-a3c052aee359";
content = {
type = "luks";
name = "crypted";
settings = {
allowDiscards = true;
bypassWorkqueues = true;
};
content = {
type = "btrfs";
extraArgs = ["-f"];
subvolumes = {
"/nix" = {
mountpoint = "/nix";
mountOptions = ["compress=zstd" "noatime"];
};
"/persist" = {
mountpoint = "/persist";
mountOptions = ["compress=zstd" "noatime"];
};
};
};
};
};
};
};
fileSystems."/persist".neededForBoot = true;
}
+2
View File
@@ -19,6 +19,8 @@ nixpkgs.lib.nixosSystem {
inputs.nix-index-database.nixosModules.default
inputs.helium-browser.nixosModules.default
inputs.impermanence.nixosModules.impermanence
inputs.disko.nixosModules.disko
./disko.nix
./configuration.nix
];
}
+2 -33
View File
@@ -1,6 +1,4 @@
# 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.
# Hardware detection - filesystems are managed by disko.nix
{
config,
lib,
@@ -11,42 +9,13 @@
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"uas"
"usbhid"
"sd_mod"
];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "usb_storage" "usbhid" "uas" "sd_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [];
fileSystems."/" = {
device = "/dev/disk/by-uuid/6320d3c6-0231-45ec-817a-c6f0e39aab73";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/5251-9B85";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
swapDevices = [];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
# networking.interfaces.enp7s0f4u1u4.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}