I don't know if i like this

This commit is contained in:
Gerg-L 2025-01-17 19:18:32 -05:00
parent c6a9144ffe
commit 1b62d16ddc
Signed by: gerg-l
SSH key fingerprint: SHA256:FPYDHIkvMocr4wdmZXpgpJjsb2Tw6rASs2ISPbOb0KI
63 changed files with 369 additions and 294 deletions

View file

@ -0,0 +1,18 @@
inputs:
let
inherit (inputs.unstable) lib;
in
lib.pipe ./. [
builtins.readDir
(lib.filterAttrs (n: v: v == "regular" && lib.hasSuffix ".nix" n && n != "_default.nix"))
builtins.attrNames
(map (x: {
name = lib.pipe x [
(lib.removeSuffix (toString ./.))
(lib.removeSuffix ".nix")
(x: "disko-${x}")
];
value.disko.devices = import "${./.}/${x}" lib;
}))
builtins.listToAttrs
]

View file

@ -0,0 +1,108 @@
lib: {
disk =
lib.genAttrs
[
"0E"
"22"
]
(
name:
let
fullName = "/dev/disk/by-id/nvme-SHPP41-500GM_SSB4N6719101A4N${name}";
in
{
type = "disk";
device = fullName;
content = {
type = "gpt";
partitions = {
BOOT = {
device = "${fullName}-part1";
type = "EF00";
start = "0";
end = "4G";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/efi${name}";
mountOptions = [ "umask=007" ];
};
};
swap = {
device = "${fullName}-part2";
start = "5G";
end = "21G";
content = {
type = "swap";
randomEncryption = true;
};
};
zfsroot = {
device = "${fullName}-part3";
start = "21G";
end = "100%";
content = {
type = "zfs";
pool = "rpool";
};
};
};
};
}
);
zpool = {
rpool = {
type = "zpool";
mode = "mirror";
rootFsOptions = {
acltype = "posixacl";
compression = "zstd";
dnodesize = "auto";
normalization = "formD";
relatime = "on";
xattr = "sa";
encryption = "on";
keyformat = "passphrase";
keylocation = "prompt";
mountpoint = "none";
};
options = {
ashift = "12";
autotrim = "on";
};
datasets = {
"root" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/";
postCreateHook = "zfs snapshot rpool/root@empty";
};
"nix" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/nix";
postCreateHook = "zfs snapshot rpool/nix@empty";
};
"var" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/var";
postCreateHook = "zfs snapshot rpool/var@empty";
};
"persist" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/persist";
postCreateHook = "zfs snapshot rpool/persist@empty";
};
"home" = {
type = "zfs_fs";
options.mountpoint = "legacy";
mountpoint = "/home";
postCreateHook = "zfs snapshot rpool/home@empty";
};
};
};
};
}

View file

@ -0,0 +1,36 @@
_: {
disk.sda =
let
baseDevice = "/dev/disk/by-id/ata-WDC_WDS240G2G0A-00JH30_180936803144";
in
{
device = baseDevice;
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
device = "${baseDevice}-part1";
start = "1MiB";
end = "1GiB";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
device = "${baseDevice}-part2";
start = "1GiB";
end = "100%";
type = "EF00";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
}

View file

@ -0,0 +1,34 @@
_: {
disk = {
main = {
device = "/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_51127661";
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02";
};
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "xfs";
mountpoint = "/";
};
};
};
};
};
};
}