This commit is contained in:
2025-12-31 15:01:09 +01:00
parent f39c1b0f57
commit 7fb80baf59
4 changed files with 118 additions and 38 deletions

21
flake.lock generated
View File

@@ -1,5 +1,25 @@
{ {
"nodes": { "nodes": {
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1766150702,
"narHash": "sha256-P0kM+5o+DKnB6raXgFEk3azw8Wqg5FL6wyl9jD+G5a4=",
"owner": "nix-community",
"repo": "disko",
"rev": "916506443ecd0d0b4a0f4cf9d40a3c22ce39b378",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"hardware": { "hardware": {
"locked": { "locked": {
"lastModified": 1767070591, "lastModified": 1767070591,
@@ -92,6 +112,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"disko": "disko",
"hardware": "hardware", "hardware": "hardware",
"home-manager": "home-manager", "home-manager": "home-manager",
"impermanence": "impermanence", "impermanence": "impermanence",

View File

@@ -18,6 +18,11 @@
inputs.home-manager.follows = "home-manager"; inputs.home-manager.follows = "home-manager";
}; };
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = { sops-nix = {
url = "github:mic92/sops-nix"; url = "github:mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";

View File

@@ -0,0 +1,5 @@
{
}: {
}

View File

@@ -1,44 +1,93 @@
# 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, ... }:
{ {inputs, ... }: {
imports = imports = [
[ (modulesPath + "/installer/scan/not-detected.nix") inputs.disko.nixosModules.disko
]; ../common/optional/ephermal-btrfs.nix
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; boot = {
boot.initrd.kernelModules = [ ]; initrd = {
boot.kernelModules = [ "kvm-amd" ]; availableKernelModules = [
boot.extraModulePackages = [ ]; "nvme"
"xhci_pci"
fileSystems."/" = "ahci"
{ device = "/dev/disk/by-uuid/cdcfbbfa-ae65-48ff-acfd-1ceba3376f2f"; "usb_storage"
fsType = "ext4"; "usbhid"
"sd_mod"
];
kernelModules = ["kvm-amd"];
}; };
loader = {
fileSystems."/boot" = systemd-boot = {
{ device = "/dev/disk/by-uuid/7C92-2CC6"; enable = true;
fsType = "vfat"; consoleMode = "max";
options = [ "fmask=0077" "dmask=0077" ]; };
efi.canTouchEfiVariables = true;
}; };
};
swapDevices = disko.devices.disk.main = {
[ { device = "/dev/disk/by-uuid/f8b826c3-629d-4e11-a902-d076d16be33b"; } device = "/dev/nvme0n1";
]; type = "disk";
content = {
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking type = "gpt";
# (the default) this is the recommended approach. When using systemd-networkd it's partions = {
# still possible to use this option, but it's recommended to use it in conjunction boot = {
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. size = "1M";
networking.useDHCP = lib.mkDefault true; type = "EF02";
# networking.interfaces.enp3s0.useDHCP = lib.mkDefault true; };
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true; esp = {
# networking.interfaces.enp5s0f0np0.useDHCP = lib.mkDefault true; name = "ESP";
# networking.interfaces.enp5s0f1np1.useDHCP = lib.mkDefault true; size = "512M";
# networking.interfaces.wlp6s0.useDHCP = lib.mkDefault true; type = "EF00";
content = {
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; type = "filesystem";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; format = "vfat";
mountpoint = "/boot";
};
};
luks = {
size = "100%";
content = {
name = "root";
type = "luks";
settings.allowDiscards = true;
content = {
type = "btrfs";
postCreateHook = ''
MNTPOINT=$(mktemp -d)
mount -t btrfs "$device" "$MNTPOINT"
trap 'umount $MNTPOINT; rm -d $MNTPOINT' EXIT
btrfs subvolume snapshot -r $MNTPOINT/root $MNTPOINT/root-blank
'';
subvolumes = {
"/root" = {
mountOptions = ["compress=zstd"];
mountpoint = "/";
};
"/nix" = {
mountOptions = ["compress=zstd" "noatime"];
mountpoint = "/nix";
};
"/persist" = {
mountOptions = ["compress=zstd"];
mountpoint = "/persist";
};
"/swap" = {
mountOptions = ["compress=zstd" "noatime"];
mountpoint = "/swap";
swap.swapfile = {
size = "60G";
path = "swapfile";
};
};
};
};
};
};
};
};
};
} }