Revert "Merge pull request 'machine_id_v2' (#2052) from Qubasa/clan-core:machine_id_v2 into main"

This reverts commit 22a11abfe5, reversing
changes made to 208b71ac0e.
This commit is contained in:
a-kenji
2024-09-10 14:01:12 +02:00
parent b0e8ae7adb
commit b13ed922b1
28 changed files with 254 additions and 545 deletions

View File

@@ -1,5 +0,0 @@
---
description = "Disables early fact generation in clanCore"
---
This module isn't meant for everyone. It's made for internal use or for those who prefer not to create facts for a machine.

View File

@@ -1,33 +0,0 @@
{
config,
lib,
...
}:
let
cfg = config.clan.factless;
in
{
# These options are reexported here to allow the inventory to set them
options.clan.factless = {
machineId = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "A machine id based on the UUID v4 format";
default = null;
};
diskId = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "The disk id, changing this will require a new installation";
default = null;
};
};
config = {
clan.core.machine = {
generateMachineId = false;
generateDiskId = false;
machineId = cfg.machineId;
diskId = cfg.diskId;
};
};
}

View File

@@ -1 +0,0 @@
{ }

View File

@@ -7,7 +7,6 @@
deltachat = ./deltachat;
dyndns = ./dyndns;
ergochat = ./ergochat;
factless = ./factless;
garage = ./garage;
golem-provider = ./golem-provider;
heisenbridge = ./heisenbridge;

View File

@@ -1,66 +1,53 @@
{ lib, config, ... }:
let
cfg = config.clan.single-disk;
suffix = config.clan.core.machine.diskId;
in
{
options.clan.single-disk = {
device = lib.mkOption {
default = null;
type = lib.types.nullOr lib.types.str;
description = "The primary disk device to install the system on";
# Question: should we set a default here?
# default = "/dev/null";
};
};
config = lib.mkMerge [
({
assertions = [
{
assertion = suffix != null;
message = "Please run `clan facts generate` or import `clanModules.factless`";
}
];
})
(lib.mkIf (suffix != null) {
boot.loader.grub.efiSupport = lib.mkDefault true;
boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true;
disko.devices = {
disk = {
"main" = {
name = suffix;
type = "disk";
# This is set through the UI
device = cfg.device;
config = {
boot.loader.grub.efiSupport = lib.mkDefault true;
boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true;
disko.devices = {
disk = {
main = {
type = "disk";
# This is set through the UI
device = config.clan.single-disk.device;
content = {
type = "gpt";
partitions = {
"boot" = {
size = "1M";
type = "EF02"; # for grub MBR
priority = 1;
content = {
type = "gpt";
partitions = {
"${config.networking.hostName}-boot" = {
size = "1M";
type = "EF02"; # for grub MBR
priority = 1;
};
"${config.networking.hostName}-ESP" = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
"ESP" = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
"root" = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
"${config.networking.hostName}-root" = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
})
];
};
};
}