initial commit
flake-check / flake-check (push) Canceled after 0s
lint / lint (push) Canceled after 0s
diff-tag / dix (push) Canceled after 0s

This commit is contained in:
Floweynt
2026-08-31 08:41:45 -05:00
commit 76fa38e34c
54 changed files with 6747 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
_: {
# New host: copy this file to hosts/<name>.nix. Replace fileSystems/boot
# below with the real hardware (see hosts/server-n0.nix for a bigger
# example). Add a containers/<name>/ directory for its containers.
module =
{ lib, hostInfo, ... }:
{
networking.hostName = hostInfo.hostname;
fileSystems."/" = {
device = "/dev/disk/by-label/NIXOS_ROOT";
fsType = "ext4";
};
fileSystems."/persist" = {
device = "/dev/disk/by-label/NIXOS_PERSIST";
fsType = "ext4";
};
fileSystems."/nix" = {
device = "/dev/disk/by-label/NIXOS_NIX";
fsType = "ext4";
};
fileSystems."/var/log" = {
device = "/dev/disk/by-label/NIXOS_VARLOG";
fsType = "ext4";
neededForBoot = true;
};
boot.loader.grub.device = "nodev";
boot.loader.grub.efiSupport = true;
boot.loader.efi.canTouchEfiVariables = true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
};
}
+23
View File
@@ -0,0 +1,23 @@
mkdir -p /mnt
echo "--- erasing system state begin ---"
# We first mount the btrfs root to /mnt
# so we can manipulate btrfs subvolumes.
mount -o subvol=/ /dev/disk/by-uuid/5dfd3b74-2162-4167-825b-21259ca48820 /mnt
# back up the old root (important!!)
BOOTID=$(date +"@boot-%Y_%m_%d-%H_%M_%S-%s")
echo "backing up old root: /mnt/@root/ -> /mnt/@old-roots/$BOOTID..."
echo "note that the timestamp is of *this* boot, not of the boot that created the old root!"
mv /mnt/@root /mnt/@old-roots/$BOOTID
btrfs property set -f -ts /mnt/@old-roots/$BOOTID ro true
echo "restoring blank /@root subvolume..."
btrfs subvolume snapshot /mnt/@root-blank /mnt/@root
# Once we're done rolling back to a blank snapshot,
# we can unmount /mnt and continue on the boot process.
echo "--- erasing system state end ---"
umount /mnt
+109
View File
@@ -0,0 +1,109 @@
_: {
module =
{
config,
lib,
pkgs,
modulesPath,
hostInfo,
...
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
networking.hostName = hostInfo.hostname;
fileSystems."/" = {
device = "/dev/disk/by-uuid/5dfd3b74-2162-4167-825b-21259ca48820";
fsType = "btrfs";
options = [
"subvol=@root"
"noatime"
"compress=zstd"
];
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/5dfd3b74-2162-4167-825b-21259ca48820";
fsType = "btrfs";
options = [
"subvol=@nix"
"noatime"
"compress=zstd"
];
};
fileSystems."/persist" = {
device = "/dev/disk/by-uuid/5dfd3b74-2162-4167-825b-21259ca48820";
fsType = "btrfs";
options = [
"subvol=@persist"
"noatime"
"compress=zstd"
];
};
fileSystems."/btrfs_root" = {
device = "/dev/disk/by-uuid/5dfd3b74-2162-4167-825b-21259ca48820";
fsType = "btrfs";
options = [
"noatime"
"ro"
"compress=zstd"
];
};
fileSystems."/var/log" = {
device = "/dev/disk/by-uuid/5dfd3b74-2162-4167-825b-21259ca48820";
fsType = "btrfs";
options = [
"subvol=@logs"
"noatime"
"compress=zstd"
];
neededForBoot = true;
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/7155-EF89";
fsType = "vfat";
options = [
"fmask=0022"
"dmask=0022"
];
};
boot = {
loader.limine.enable = true;
kernelPackages = pkgs.linuxPackages_latest;
kernelModules = [ "kvm-intel" ];
extraModprobeConfig = "options kvm_intel nested=1";
extraModulePackages = [ ];
supportedFilesystems = [ "btrfs" ];
initrd = {
compressorArgs = [
"-22"
"-T0"
"--long"
"--ultra"
];
availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
];
kernelModules = [ ];
systemd.enable = false;
postDeviceCommands = lib.mkBefore (builtins.readFile ./server-n0-darling-erasure.sh);
};
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.enableRedistributableFirmware = true;
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
};
}