Revamp
This commit is contained in:
parent
e06b409221
commit
2c37447ec3
26 changed files with 861 additions and 494 deletions
73
modules/machine.nix
Normal file
73
modules/machine.nix
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
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";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue