clanCore: init machine_id.nix with clan.core.machine.{id,diskId}

This commit is contained in:
Qubasa
2024-09-06 18:05:40 +02:00
parent 0d83a59d8e
commit b16a53f510
28 changed files with 219 additions and 48 deletions

View File

@@ -1,4 +1,7 @@
{ lib, config, ... }:
let
cfg = config.clan.single-disk;
in
{
options.clan.single-disk = {
device = lib.mkOption {
@@ -8,26 +11,38 @@
# Question: should we set a default here?
# default = "/dev/null";
};
suffix = lib.mkOption {
default = config.clan.core.machine.diskId;
defaultText = "abcdef";
type = lib.types.nullOr lib.types.str;
description = "The suffix to use for the disk";
};
};
config = {
assertions = [
{
assertion = cfg.suffix != null;
message = "clan.core.machine.diskId must be set, please run `clan facts generate`";
}
];
boot.loader.grub.efiSupport = lib.mkDefault true;
boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true;
disko.devices = {
disko.devices = lib.mkIf (cfg.suffix != null) {
disk = {
main = {
type = "disk";
# This is set through the UI
device = config.clan.single-disk.device;
device = cfg.device;
content = {
type = "gpt";
partitions = {
"${config.networking.hostName}-boot" = {
"boot-${cfg.suffix}" = {
size = "1M";
type = "EF02"; # for grub MBR
priority = 1;
};
"${config.networking.hostName}-ESP" = {
"ESP-${cfg.suffix}" = {
size = "512M";
type = "EF00";
content = {
@@ -36,7 +51,7 @@
mountpoint = "/boot";
};
};
"${config.networking.hostName}-root" = {
"root-${cfg.suffix}" = {
size = "100%";
content = {
type = "filesystem";