Files
nixos/hardware/disko.nix
2026-03-13 19:14:07 +00:00

64 lines
2.0 KiB
Nix

{ disko, hostname, ... }:
let
mkDisk = { hostname, drive }: {
type = "disk";
# Check this with lsblk
device = drive;
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "fmask=0022" "dmask=0022" "umask=0077" ];
};
};
root = {
size = "100%";
content = {
type = "btrfs";
# Force overwrite
extraArgs = [ "-f" ];
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/swap" = {
mountpoint = "/.swapvol";
swap.swapfile.size = "8G";
};
};
};
};
};
};
};
in
# nix --extra-experimental-features "nix-command flakes" run github:nix-community/disko/latest#disko-install -- --flake ./#${hostname} --disk stationette --write-efi-boot-entries ${drive}
{
imports = [ disko.nixosModules.disko ];
disko.devices = {
disk = {
"${hostname}" = mkDisk {
inherit hostname;
drive = if hostname == "station" then "/dev/nvme0n1" else "/dev/sda";
};
};
};
}