nixos-config/modules/nixos/presets/disko/ext4/default.nix
2025-08-11 14:23:54 +02:00

47 lines
903 B
Nix

{
lib,
pkgs,
inputs,
namespace,
system,
target,
format,
virtual,
systems,
config,
...
}:
with lib;
with lib.${namespace}; let
cfg = config.${namespace}.presets.disko.ext4;
in {
options.${namespace}.presets.disko.ext4 = with types; {
enable = mkBoolOpt false "Enable preset";
device = mkOpt' str "/dev/nvme0n1";
mountpoint = mkOpt' path "/";
};
config = mkIf cfg.enable {
disko.devices = {
disk = {
"${cfg.device}" = {
inherit device;
type = "disk";
content = {
type = "gpt";
partitions = {
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
inherit (cfg) mountpoint;
};
};
};
};
};
};
};
};
}