73 lines
1.7 KiB
Nix
73 lines
1.7 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib)
|
|
mkAliasOptionModule
|
|
mkOption
|
|
types
|
|
;
|
|
in
|
|
{
|
|
options.machine = {
|
|
mainUser = mkOption {
|
|
type = types.str;
|
|
description = "The main user of the machine";
|
|
};
|
|
|
|
hostName = mkOption {
|
|
type = types.str;
|
|
description = "The name of the machine";
|
|
};
|
|
|
|
filesystem.uuid = {
|
|
boot = mkOption {
|
|
type = types.nullOr types.str;
|
|
description = "The UUID of the XBOOTLDR partition.";
|
|
default = null;
|
|
};
|
|
|
|
esp = mkOption {
|
|
type = types.nullOr types.str;
|
|
description = "The UUID of the ESP.";
|
|
default = null;
|
|
};
|
|
|
|
luks = mkOption {
|
|
type = types.nullOr types.str;
|
|
description = "The UUID of the encrypted root partition.";
|
|
default = null;
|
|
};
|
|
|
|
cryptroot = mkOption {
|
|
type = types.nullOr types.str;
|
|
description = "The UUID of the decrypted root partition.";
|
|
default = null;
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf pkgs.stdenv.hostPlatform.isLinux {
|
|
assertions = [
|
|
{
|
|
assertion = config.machine.filesystem.uuid.boot != null;
|
|
message = "machine.filesystem.uuid.boot must be set on Linux systems";
|
|
}
|
|
{
|
|
assertion = config.machine.filesystem.uuid.esp != null;
|
|
message = "machine.filesystem.uuid.esp must be set on Linux systems";
|
|
}
|
|
{
|
|
assertion = config.machine.filesystem.uuid.luks != null;
|
|
message = "machine.filesystem.uuid.luks must be set on Linux systems";
|
|
}
|
|
{
|
|
assertion = config.machine.filesystem.uuid.cryptroot != null;
|
|
message = "machine.filesystem.cryptroot.esp must be set on Linux systems";
|
|
}
|
|
];
|
|
};
|
|
}
|