chore(marr): add disko config

This commit is contained in:
Nydragon 2024-10-20 13:09:02 +00:00
parent 9bfb7d5db0
commit 6262428dc6
Signed by: nydragon
SSH key fingerprint: SHA256:WcjW5NJPQ8Dx4uQDmoIlVPLWE27Od3fxoe0IUvuoPHE
3 changed files with 76 additions and 1 deletions

View file

@ -13,7 +13,10 @@ in
(mkSystem' { (mkSystem' {
hostname = "marr"; hostname = "marr";
system = "x86_64-linux"; system = "x86_64-linux";
extraModules = [ inputs.agenix.nixosModules.default ]; extraModules = [
inputs.disko.nixosModules.disko
inputs.agenix.nixosModules.default
];
}) })
(mkSystem' { (mkSystem' {

42
hosts/marr/disko.nix Normal file
View file

@ -0,0 +1,42 @@
{ lib, ... }:
let
inherit (lib.my.disko) mkBoot mkSwap mkRoot;
in
{
disko.devices = {
disk.builtin = {
device = "/dev/nvme0n1";
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = mkBoot "1G";
luks = {
size = "100%";
content = {
type = "luks";
name = "crypt";
settings = {
keyFile = "/tmp/secret.key";
allowDiscards = true;
};
content = {
type = "lvm_pv";
vg = "pool";
};
};
};
};
};
};
lvm_vg = {
pool = {
type = "lvm_vg";
lvs = {
swap = mkSwap "32G";
root = mkRoot "100%" "ext4";
};
};
};
};
}

View file

@ -79,4 +79,34 @@ in
inherit (lib.strings) sanitizeDerivationName; inherit (lib.strings) sanitizeDerivationName;
in in
str: (sanitizeDerivationName (lib.toLower str)); str: (sanitizeDerivationName (lib.toLower str));
disko = {
mkBoot = size: {
size = size;
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
mkSwap = size: {
size = "32G";
content = {
type = "swap";
randomEncryption = true;
priority = 100;
};
};
mkRoot = size: format: {
inherit size;
content = {
inherit format;
type = "filesystem";
mountpoint = "/";
mountOptions = [ "defaults" ];
};
};
};
} }