revert machine_id pull request
This commit is contained in:
@@ -134,10 +134,6 @@
|
|||||||
];
|
];
|
||||||
virtualisation.emptyDiskImages = [ 256 ];
|
virtualisation.emptyDiskImages = [ 256 ];
|
||||||
clan.core.clanDir = ./.;
|
clan.core.clanDir = ./.;
|
||||||
clan.core.machine = {
|
|
||||||
id = "a73f5245cdba4576ab6cfef3145ac9ec";
|
|
||||||
diskId = "c4c47b";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
|
|||||||
@@ -18,10 +18,6 @@
|
|||||||
{
|
{
|
||||||
clan.core.machineName = "machine";
|
clan.core.machineName = "machine";
|
||||||
clan.core.clanDir = ./.;
|
clan.core.clanDir = ./.;
|
||||||
clan.core.machine = {
|
|
||||||
id = "a73f5245cdba4576ab6cfef3145ac9ec";
|
|
||||||
diskId = "c4c47b";
|
|
||||||
};
|
|
||||||
clan.core.state.testState.folders = [ "/etc/state" ];
|
clan.core.state.testState.folders = [ "/etc/state" ];
|
||||||
environment.etc.state.text = "hello world";
|
environment.etc.state.text = "hello world";
|
||||||
systemd.tmpfiles.settings."vmsecrets" = {
|
systemd.tmpfiles.settings."vmsecrets" = {
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
networking.hostName = "machine";
|
networking.hostName = "machine";
|
||||||
services.openssh.enable = true;
|
services.openssh.enable = true;
|
||||||
services.openssh.startWhenNeeded = false;
|
services.openssh.startWhenNeeded = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
testScript = ''
|
testScript = ''
|
||||||
start_all()
|
start_all()
|
||||||
|
|||||||
@@ -12,10 +12,6 @@
|
|||||||
{
|
{
|
||||||
clan.core.machineName = "machine";
|
clan.core.machineName = "machine";
|
||||||
clan.core.clanDir = ./.;
|
clan.core.clanDir = ./.;
|
||||||
clan.core.machine = {
|
|
||||||
id = "a73f5245cdba4576ab6cfef3145ac9ec";
|
|
||||||
diskId = "c4c47b";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
let
|
let
|
||||||
dependencies = [
|
dependencies = [
|
||||||
pkgs.disko
|
pkgs.disko
|
||||||
pkgs.age
|
|
||||||
self.clanInternals.machines.${pkgs.hostPlatform.system}.test-install-machine.config.system.build.toplevel
|
self.clanInternals.machines.${pkgs.hostPlatform.system}.test-install-machine.config.system.build.toplevel
|
||||||
self.clanInternals.machines.${pkgs.hostPlatform.system}.test-install-machine.config.system.build.diskoScript
|
self.clanInternals.machines.${pkgs.hostPlatform.system}.test-install-machine.config.system.build.diskoScript
|
||||||
self.clanInternals.machines.${pkgs.hostPlatform.system}.test-install-machine.config.system.build.diskoScript.drvPath
|
self.clanInternals.machines.${pkgs.hostPlatform.system}.test-install-machine.config.system.build.diskoScript.drvPath
|
||||||
@@ -26,11 +25,9 @@
|
|||||||
nodes.target = {
|
nodes.target = {
|
||||||
virtualisation.emptyDiskImages = [ 4096 ];
|
virtualisation.emptyDiskImages = [ 4096 ];
|
||||||
virtualisation.memorySize = 3000;
|
virtualisation.memorySize = 3000;
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [ self.packages.${pkgs.system}.clan-cli ];
|
||||||
self.packages.${pkgs.system}.clan-cli
|
|
||||||
] ++ self.packages.${pkgs.system}.clan-cli.runtimeDependencies;
|
|
||||||
environment.variables."SOPS_AGE_KEY" = builtins.readFile ../lib/age/privkey;
|
|
||||||
environment.etc."install-closure".source = "${closureInfo}/store-paths";
|
environment.etc."install-closure".source = "${closureInfo}/store-paths";
|
||||||
|
|
||||||
nix.settings = {
|
nix.settings = {
|
||||||
substituters = lib.mkForce [ ];
|
substituters = lib.mkForce [ ];
|
||||||
hashed-mirrors = null;
|
hashed-mirrors = null;
|
||||||
@@ -41,15 +38,11 @@
|
|||||||
"flakes"
|
"flakes"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
system.extraDependencies = dependencies;
|
|
||||||
};
|
};
|
||||||
testScript = ''
|
testScript = ''
|
||||||
start_all()
|
start_all()
|
||||||
|
|
||||||
machine.succeed("cp -r ${../..} test-flake && chmod -R +w test-flake")
|
machine.succeed("clan flash --debug --flake ${../..} --yes --disk main /dev/vdb test-install-machine")
|
||||||
machine.succeed("clan secrets key generate")
|
|
||||||
machine.succeed("clan secrets users add --debug --flake test-flake testuser '${builtins.readFile ../lib/age/pubkey}'")
|
|
||||||
machine.succeed("clan flash --debug --flake test-flake --yes --disk main /dev/vdb test-install-machine")
|
|
||||||
'';
|
'';
|
||||||
} { inherit pkgs self; };
|
} { inherit pkgs self; };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
{ self, lib, ... }:
|
{ self, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
clan.machines.test-install-machine = {
|
clan.machines.test-install-machine = {
|
||||||
clan.core.networking.targetHost = "test-install-machine";
|
clan.core.networking.targetHost = "test-install-machine";
|
||||||
clan.core.machine = {
|
|
||||||
id = "a73f5245cdba4576ab6cfef3145ac9ec";
|
|
||||||
diskId = "c4c47b";
|
|
||||||
};
|
|
||||||
fileSystems."/".device = lib.mkDefault "/dev/vdb";
|
fileSystems."/".device = lib.mkDefault "/dev/vdb";
|
||||||
boot.loader.grub.device = lib.mkDefault "/dev/vdb";
|
boot.loader.grub.device = lib.mkDefault "/dev/vdb";
|
||||||
|
|
||||||
@@ -22,10 +17,7 @@
|
|||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
(modulesPath + "/profiles/qemu-guest.nix")
|
||||||
];
|
];
|
||||||
clan.single-disk.device = "/dev/vdb";
|
clan.single-disk.device = "/dev/vdb";
|
||||||
clan.core.machine = {
|
|
||||||
id = "a73f5245cdba4576ab6cfef3145ac9ec";
|
|
||||||
diskId = "c4c47b";
|
|
||||||
};
|
|
||||||
environment.etc."install-successful".text = "ok";
|
environment.etc."install-successful".text = "ok";
|
||||||
|
|
||||||
boot.consoleLogLevel = lib.mkForce 100;
|
boot.consoleLogLevel = lib.mkForce 100;
|
||||||
@@ -42,10 +34,8 @@
|
|||||||
let
|
let
|
||||||
dependencies = [
|
dependencies = [
|
||||||
self
|
self
|
||||||
pkgs.age
|
|
||||||
self.nixosConfigurations.test-install-machine.config.system.build.toplevel
|
self.nixosConfigurations.test-install-machine.config.system.build.toplevel
|
||||||
self.nixosConfigurations.test-install-machine.config.system.build.diskoScript
|
self.nixosConfigurations.test-install-machine.config.system.build.diskoScript
|
||||||
self.clanInternals.machines.${pkgs.hostPlatform.system}.test-install-machine.config.system.build.diskoScript.drvPath
|
|
||||||
self.nixosConfigurations.test-install-machine.config.system.clan.deployment.file
|
self.nixosConfigurations.test-install-machine.config.system.clan.deployment.file
|
||||||
pkgs.stdenv.drvPath
|
pkgs.stdenv.drvPath
|
||||||
pkgs.nixos-anywhere
|
pkgs.nixos-anywhere
|
||||||
@@ -60,7 +50,6 @@
|
|||||||
services.openssh.enable = true;
|
services.openssh.enable = true;
|
||||||
users.users.root.openssh.authorizedKeys.keyFiles = [ ../lib/ssh/pubkey ];
|
users.users.root.openssh.authorizedKeys.keyFiles = [ ../lib/ssh/pubkey ];
|
||||||
system.nixos.variant_id = "installer";
|
system.nixos.variant_id = "installer";
|
||||||
|
|
||||||
virtualisation.emptyDiskImages = [ 4096 ];
|
virtualisation.emptyDiskImages = [ 4096 ];
|
||||||
nix.settings = {
|
nix.settings = {
|
||||||
substituters = lib.mkForce [ ];
|
substituters = lib.mkForce [ ];
|
||||||
@@ -78,7 +67,6 @@
|
|||||||
self.packages.${pkgs.system}.clan-cli
|
self.packages.${pkgs.system}.clan-cli
|
||||||
] ++ self.packages.${pkgs.system}.clan-cli.runtimeDependencies;
|
] ++ self.packages.${pkgs.system}.clan-cli.runtimeDependencies;
|
||||||
environment.etc."install-closure".source = "${closureInfo}/store-paths";
|
environment.etc."install-closure".source = "${closureInfo}/store-paths";
|
||||||
environment.variables."SOPS_AGE_KEY" = builtins.readFile ../lib/age/privkey;
|
|
||||||
virtualisation.memorySize = 2048;
|
virtualisation.memorySize = 2048;
|
||||||
nix.settings = {
|
nix.settings = {
|
||||||
substituters = lib.mkForce [ ];
|
substituters = lib.mkForce [ ];
|
||||||
@@ -111,11 +99,9 @@
|
|||||||
client.wait_until_succeeds("timeout 2 ssh -o StrictHostKeyChecking=accept-new -v root@target hostname")
|
client.wait_until_succeeds("timeout 2 ssh -o StrictHostKeyChecking=accept-new -v root@target hostname")
|
||||||
client.succeed("cp -r ${../..} test-flake && chmod -R +w test-flake")
|
client.succeed("cp -r ${../..} test-flake && chmod -R +w test-flake")
|
||||||
client.fail("test -f test-flake/machines/test-install-machine/hardware-configuration.nix")
|
client.fail("test -f test-flake/machines/test-install-machine/hardware-configuration.nix")
|
||||||
client.succeed("clan secrets key generate")
|
client.succeed("clan machines hw-generate --flake test-flake test-install-machine root@target>&2")
|
||||||
client.succeed("clan secrets users add --debug --flake test-flake testuser '${builtins.readFile ../lib/age/pubkey}'")
|
|
||||||
client.succeed("clan machines hw-generate --debug --flake test-flake test-install-machine root@target>&2")
|
|
||||||
client.succeed("test -f test-flake/machines/test-install-machine/hardware-configuration.nix")
|
client.succeed("test -f test-flake/machines/test-install-machine/hardware-configuration.nix")
|
||||||
client.succeed("clan machines install --debug --flake test-flake --yes test-install-machine root@target >&2")
|
client.succeed("clan machines install --debug --flake ${../..} --yes test-install-machine root@target >&2")
|
||||||
try:
|
try:
|
||||||
target.shutdown()
|
target.shutdown()
|
||||||
except BrokenPipeError:
|
except BrokenPipeError:
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
AGE-SECRET-KEY-1KF8E3SR3TTGL6M476SKF7EEMR4H9NF7ZWYSLJUAK8JX276JC7KUSSURKFK
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
age1dhwqzkah943xzc34tc3dlmfayyevcmdmxzjezdgdy33euxwf59vsp3vk3c
|
|
||||||
@@ -17,10 +17,7 @@
|
|||||||
{
|
{
|
||||||
clan.core.machineName = "machine";
|
clan.core.machineName = "machine";
|
||||||
clan.core.clanDir = ./.;
|
clan.core.clanDir = ./.;
|
||||||
clan.core.machine = {
|
|
||||||
id = "a73f5245cdba4576ab6cfef3145ac9ec";
|
|
||||||
diskId = "c4c47b";
|
|
||||||
};
|
|
||||||
services.nginx.virtualHosts."matrix.clan.test" = {
|
services.nginx.virtualHosts."matrix.clan.test" = {
|
||||||
enableACME = lib.mkForce false;
|
enableACME = lib.mkForce false;
|
||||||
forceSSL = lib.mkForce false;
|
forceSSL = lib.mkForce false;
|
||||||
|
|||||||
@@ -32,10 +32,6 @@
|
|||||||
common
|
common
|
||||||
{
|
{
|
||||||
clan.core.machineName = "peer1";
|
clan.core.machineName = "peer1";
|
||||||
clan.core.machine = {
|
|
||||||
id = "df97124f09da48e3a22d77ce30ee8da6";
|
|
||||||
diskId = "c9c52c";
|
|
||||||
};
|
|
||||||
environment.etc = {
|
environment.etc = {
|
||||||
"mumble-key".source = ./peer_1/peer_1_test_key;
|
"mumble-key".source = ./peer_1/peer_1_test_key;
|
||||||
"mumble-cert".source = ./peer_1/peer_1_test_cert;
|
"mumble-cert".source = ./peer_1/peer_1_test_cert;
|
||||||
@@ -69,10 +65,6 @@
|
|||||||
imports = [
|
imports = [
|
||||||
common
|
common
|
||||||
{
|
{
|
||||||
clan.core.machine = {
|
|
||||||
id = "a73f5245cdba4576ab6cfef3145ac9ec";
|
|
||||||
diskId = "c4c47b";
|
|
||||||
};
|
|
||||||
clan.core.machineName = "peer2";
|
clan.core.machineName = "peer2";
|
||||||
environment.etc = {
|
environment.etc = {
|
||||||
"mumble-key".source = ./peer_2/peer_2_test_key;
|
"mumble-key".source = ./peer_2/peer_2_test_key;
|
||||||
|
|||||||
@@ -8,13 +8,7 @@ let
|
|||||||
self.nixosModules.clanCore
|
self.nixosModules.clanCore
|
||||||
# This is the only option that is not part of the
|
# This is the only option that is not part of the
|
||||||
# module because it is usually set by flake-parts
|
# module because it is usually set by flake-parts
|
||||||
{
|
{ clan.core.clanDir = ./.; }
|
||||||
clan.core.clanDir = ./.;
|
|
||||||
clan.core.machine = {
|
|
||||||
id = "df97124f09da48e3a22d77ce30ee8da6";
|
|
||||||
diskId = "c9c52c";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|||||||
@@ -15,11 +15,6 @@
|
|||||||
clan.localbackup.targets.hdd.directory = "/mnt/external-disk";
|
clan.localbackup.targets.hdd.directory = "/mnt/external-disk";
|
||||||
clan.core.clanDir = ./.;
|
clan.core.clanDir = ./.;
|
||||||
|
|
||||||
clan.core.machine = {
|
|
||||||
id = "df97124f09da48e3a22d77ce30ee8da6";
|
|
||||||
diskId = "c9c52c";
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services.sample-service = {
|
systemd.services.sample-service = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
script = ''
|
script = ''
|
||||||
|
|||||||
@@ -12,10 +12,6 @@
|
|||||||
|
|
||||||
clan.core.clanDir = "${./.}";
|
clan.core.clanDir = "${./.}";
|
||||||
clan.core.machineName = "machine";
|
clan.core.machineName = "machine";
|
||||||
clan.core.machine = {
|
|
||||||
id = "df97124f09da48e3a22d77ce30ee8da6";
|
|
||||||
diskId = "c9c52c";
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.hostName = "machine";
|
networking.hostName = "machine";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,10 +14,6 @@
|
|||||||
{
|
{
|
||||||
clan.core.machineName = "introducer";
|
clan.core.machineName = "introducer";
|
||||||
clan.core.clanDir = ./.;
|
clan.core.clanDir = ./.;
|
||||||
clan.core.machine = {
|
|
||||||
id = "df97124f09da48e3a22d77ce30ee8da6";
|
|
||||||
diskId = "c9c52c";
|
|
||||||
};
|
|
||||||
environment.etc = {
|
environment.etc = {
|
||||||
"syncthing.pam".source = ./introducer/introducer_test_cert;
|
"syncthing.pam".source = ./introducer/introducer_test_cert;
|
||||||
"syncthing.key".source = ./introducer/introducer_test_key;
|
"syncthing.key".source = ./introducer/introducer_test_key;
|
||||||
@@ -59,10 +55,6 @@
|
|||||||
{
|
{
|
||||||
clan.core.machineName = "peer1";
|
clan.core.machineName = "peer1";
|
||||||
clan.core.clanDir = ./.;
|
clan.core.clanDir = ./.;
|
||||||
clan.core.machine = {
|
|
||||||
id = "645a43ad1d6f456aa2d623464efed096";
|
|
||||||
diskId = "9404bf2fb28343cba82e64d1a9131ea4";
|
|
||||||
};
|
|
||||||
clan.syncthing.introducer = lib.strings.removeSuffix "\n" (
|
clan.syncthing.introducer = lib.strings.removeSuffix "\n" (
|
||||||
builtins.readFile ./introducer/introducer_device_id
|
builtins.readFile ./introducer/introducer_device_id
|
||||||
);
|
);
|
||||||
@@ -85,10 +77,6 @@
|
|||||||
{
|
{
|
||||||
clan.core.machineName = "peer2";
|
clan.core.machineName = "peer2";
|
||||||
clan.core.clanDir = ./.;
|
clan.core.clanDir = ./.;
|
||||||
clan.core.machine = {
|
|
||||||
id = "dd0927b2113b4fa58a94a4be15b0408e";
|
|
||||||
diskId = "05d6d08214d14261b001782b417ca2a3";
|
|
||||||
};
|
|
||||||
clan.syncthing.introducer = lib.strings.removeSuffix "\n" (
|
clan.syncthing.introducer = lib.strings.removeSuffix "\n" (
|
||||||
builtins.readFile ./introducer/introducer_device_id
|
builtins.readFile ./introducer/introducer_device_id
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,10 +16,6 @@ import ../lib/test-base.nix (
|
|||||||
{
|
{
|
||||||
clan.core.machineName = "machine";
|
clan.core.machineName = "machine";
|
||||||
clan.core.clanDir = ./.;
|
clan.core.clanDir = ./.;
|
||||||
clan.core.machine = {
|
|
||||||
id = "df97124f09da48e3a22d77ce30ee8da6";
|
|
||||||
diskId = "c9c52c";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
services.wayland-proxy-virtwl.enable = true;
|
services.wayland-proxy-virtwl.enable = true;
|
||||||
|
|||||||
@@ -12,10 +12,6 @@
|
|||||||
{
|
{
|
||||||
clan.core.machineName = "machine";
|
clan.core.machineName = "machine";
|
||||||
clan.core.clanDir = ./.;
|
clan.core.clanDir = ./.;
|
||||||
clan.core.machine = {
|
|
||||||
id = "df97124f09da48e3a22d77ce30ee8da6";
|
|
||||||
diskId = "c9c52c";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
let
|
|
||||||
cfg = config.clan.single-disk;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
options.clan.single-disk = {
|
options.clan.single-disk = {
|
||||||
device = lib.mkOption {
|
device = lib.mkOption {
|
||||||
@@ -11,38 +8,26 @@ in
|
|||||||
# Question: should we set a default here?
|
# Question: should we set a default here?
|
||||||
# default = "/dev/null";
|
# 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 = {
|
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.efiSupport = lib.mkDefault true;
|
||||||
boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true;
|
boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true;
|
||||||
disko.devices = lib.mkIf (cfg.suffix != null) {
|
disko.devices = {
|
||||||
disk = {
|
disk = {
|
||||||
main = {
|
main = {
|
||||||
type = "disk";
|
type = "disk";
|
||||||
# This is set through the UI
|
# This is set through the UI
|
||||||
device = cfg.device;
|
device = config.clan.single-disk.device;
|
||||||
|
|
||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
partitions = {
|
partitions = {
|
||||||
"boot-${cfg.suffix}" = {
|
"${config.networking.hostName}-boot" = {
|
||||||
size = "1M";
|
size = "1M";
|
||||||
type = "EF02"; # for grub MBR
|
type = "EF02"; # for grub MBR
|
||||||
priority = 1;
|
priority = 1;
|
||||||
};
|
};
|
||||||
"ESP-${cfg.suffix}" = {
|
"${config.networking.hostName}-ESP" = {
|
||||||
size = "512M";
|
size = "512M";
|
||||||
type = "EF00";
|
type = "EF00";
|
||||||
content = {
|
content = {
|
||||||
@@ -51,7 +36,7 @@ in
|
|||||||
mountpoint = "/boot";
|
mountpoint = "/boot";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"root-${cfg.suffix}" = {
|
"${config.networking.hostName}-root" = {
|
||||||
size = "100%";
|
size = "100%";
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "filesystem";
|
||||||
|
|||||||
@@ -108,7 +108,6 @@ nav:
|
|||||||
- reference/clan-core/sops.md
|
- reference/clan-core/sops.md
|
||||||
- reference/clan-core/state.md
|
- reference/clan-core/state.md
|
||||||
- reference/clan-core/deployment.md
|
- reference/clan-core/deployment.md
|
||||||
- reference/clan-core/machine.md
|
|
||||||
- reference/clan-core/networking.md
|
- reference/clan-core/networking.md
|
||||||
- Nix API:
|
- Nix API:
|
||||||
- reference/nix-api/index.md
|
- reference/nix-api/index.md
|
||||||
|
|||||||
@@ -17,19 +17,18 @@ lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT
|
|||||||
```nix hl_lines="14 40"
|
```nix hl_lines="14 40"
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let
|
||||||
suffix = config.clan.core.machine.diskId;
|
|
||||||
mirrorBoot = idx: {
|
mirrorBoot = idx: {
|
||||||
type = "disk";
|
type = "disk";
|
||||||
device = "/dev/disk/by-id/${idx}";
|
device = "/dev/disk/by-id/${idx}";
|
||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
partitions = {
|
partitions = {
|
||||||
"boot-${suffix}" = {
|
"${config.networking.hostName}-boot" = {
|
||||||
size = "1M";
|
size = "1M";
|
||||||
type = "EF02"; # for grub MBR
|
type = "EF02"; # for grub MBR
|
||||||
priority = 1;
|
priority = 1;
|
||||||
};
|
};
|
||||||
"ESP-${suffix}" = lib.mkIf (idx == "nvme-eui.002538b931b59865") {
|
"${config.networking.hostName}-ESP" = lib.mkIf (idx == "nvme-eui.002538b931b59865") {
|
||||||
size = "1G";
|
size = "1G";
|
||||||
type = "EF00";
|
type = "EF00";
|
||||||
content = {
|
content = {
|
||||||
@@ -39,7 +38,7 @@ lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT
|
|||||||
mountOptions = [ "nofail" ];
|
mountOptions = [ "nofail" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"root-${suffix}" = {
|
"${config.networking.hostName}-root" = {
|
||||||
size = "100%";
|
size = "100%";
|
||||||
content = {
|
content = {
|
||||||
type = "zfs";
|
type = "zfs";
|
||||||
@@ -109,19 +108,18 @@ lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT
|
|||||||
```nix hl_lines="14 40 41"
|
```nix hl_lines="14 40 41"
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let
|
||||||
suffix = config.clan.core.machine.diskId;
|
|
||||||
mirrorBoot = idx: {
|
mirrorBoot = idx: {
|
||||||
type = "disk";
|
type = "disk";
|
||||||
device = "/dev/disk/by-id/${idx}";
|
device = "/dev/disk/by-id/${idx}";
|
||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
partitions = {
|
partitions = {
|
||||||
"boot-${suffix}" = {
|
boot = {
|
||||||
size = "1M";
|
size = "1M";
|
||||||
type = "EF02"; # for grub MBR
|
type = "EF02"; # for grub MBR
|
||||||
priority = 1;
|
priority = 1;
|
||||||
};
|
};
|
||||||
"ESP-${suffix}" = lib.mkIf (idx == "nvme-eui.002538b931b59865") {
|
ESP = lib.mkIf (idx == "nvme-eui.002538b931b59865") {
|
||||||
size = "1G";
|
size = "1G";
|
||||||
type = "EF00";
|
type = "EF00";
|
||||||
content = {
|
content = {
|
||||||
@@ -131,7 +129,7 @@ lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT
|
|||||||
mountOptions = [ "nofail" ];
|
mountOptions = [ "nofail" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"root-${suffix}" = {
|
zfs = {
|
||||||
size = "100%";
|
size = "100%";
|
||||||
content = {
|
content = {
|
||||||
type = "zfs";
|
type = "zfs";
|
||||||
|
|||||||
@@ -88,8 +88,7 @@
|
|||||||
"machines": {
|
"machines": {
|
||||||
"test-inventory-machine": {
|
"test-inventory-machine": {
|
||||||
"config": {
|
"config": {
|
||||||
"device": "/dev/null",
|
"device": "/dev/null"
|
||||||
"suffix": "foobar"
|
|
||||||
},
|
},
|
||||||
"imports": []
|
"imports": []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ let
|
|||||||
evaled = lib.evalModules {
|
evaled = lib.evalModules {
|
||||||
modules = [
|
modules = [
|
||||||
baseModule
|
baseModule
|
||||||
({
|
|
||||||
clan.core.clanDir = ./.;
|
|
||||||
})
|
|
||||||
clan-core.nixosModules.clanCore
|
clan-core.nixosModules.clanCore
|
||||||
] ++ (map (name: clanModules.${name}) modulenames);
|
] ++ (map (name: clanModules.${name}) modulenames);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,27 +23,27 @@ let
|
|||||||
description = ''
|
description = ''
|
||||||
List of imported '.nix' files.
|
List of imported '.nix' files.
|
||||||
|
|
||||||
Each filename must be a string and is interpreted relative to the 'directory' passed to buildClan.
|
Each filename must be a string and is interpreted relative to the 'directory' passed to buildClan.
|
||||||
The import only happens if the machine is part of the service or role.
|
The import only happens if the machine is part of the service or role.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
To import the `special.nix` file
|
To import the `special.nix` file
|
||||||
|
|
||||||
```
|
```
|
||||||
. Clan Directory
|
. Clan Directory
|
||||||
├── flake.nix
|
├── flake.nix
|
||||||
...
|
...
|
||||||
└── modules
|
└── modules
|
||||||
├── special.nix
|
├── special.nix
|
||||||
└── ...
|
└── ...
|
||||||
```
|
```
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
imports = [ "modules/special.nix" ];
|
imports = [ "modules/special.nix" ];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
'';
|
'';
|
||||||
default = [ ];
|
default = [ ];
|
||||||
|
|||||||
@@ -18,6 +18,5 @@
|
|||||||
./vm.nix
|
./vm.nix
|
||||||
./wayland-proxy-virtwl.nix
|
./wayland-proxy-virtwl.nix
|
||||||
./zerotier
|
./zerotier
|
||||||
./machine_id.nix
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.clan.core.machine;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.clan.core.machine = {
|
|
||||||
id = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
description = "The machine id";
|
|
||||||
};
|
|
||||||
idShort = lib.mkOption {
|
|
||||||
readOnly = true;
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
description = "The short machine id";
|
|
||||||
};
|
|
||||||
diskId = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
description = "The disk id";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
|
||||||
clan.core.machine.id =
|
|
||||||
lib.mkDefault
|
|
||||||
config.clan.core.facts.services."machine_id".public."machine_id".value;
|
|
||||||
clan.core.machine.idShort = if (cfg.id != null) then (lib.substring 0 8 cfg.id) else null;
|
|
||||||
|
|
||||||
clan.core.machine.diskId =
|
|
||||||
lib.mkDefault
|
|
||||||
config.clan.core.facts.services."machine_id".public."diskId".value;
|
|
||||||
|
|
||||||
clan.core.facts.services."machine_id" = {
|
|
||||||
public."machine_id" = { };
|
|
||||||
public."diskId" = { };
|
|
||||||
generator.path = [
|
|
||||||
pkgs.coreutils
|
|
||||||
];
|
|
||||||
generator.script = ''
|
|
||||||
machine_uuid=$(dd if=/dev/urandom bs=1 count=16 2>/dev/null | od -An -tx1 | tr -d ' \n')
|
|
||||||
disk_uuid=$(dd if=/dev/urandom bs=1 count=3 2>/dev/null | od -An -tx1 | tr -d ' \n')
|
|
||||||
echo -n "$machine_uuid" > "$facts"/machine_id
|
|
||||||
echo -n "$disk_uuid" > "$facts"/diskId
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
networking.hostId = lib.mkIf (cfg.id != null) (lib.mkDefault cfg.idShort);
|
|
||||||
|
|
||||||
boot.kernelParams = lib.mkIf (cfg.id != null) [
|
|
||||||
''systemd.machine_id=${cfg.id}''
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -112,15 +112,15 @@ const InstallMachine = (props: InstallMachineProps) => {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const curr_uri = activeURI();
|
const curr_uri = activeURI();
|
||||||
const disk = getValue(formStore, "disk");
|
const disk = getValue(formStore, "disk");
|
||||||
const diskId = props.disks.find((d) => d.name === disk)?.id_link;
|
const disk_id = props.disks.find((d) => d.name === disk)?.id_link;
|
||||||
if (!curr_uri || !diskId || !props.name) {
|
if (!curr_uri || !disk_id || !props.name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const r = await callApi("set_single_disk_uuid", {
|
const r = await callApi("set_single_disk_uuid", {
|
||||||
base_path: curr_uri,
|
base_path: curr_uri,
|
||||||
machine_name: props.name,
|
machine_name: props.name,
|
||||||
disk_uuid: diskId,
|
disk_uuid: disk_id,
|
||||||
});
|
});
|
||||||
if (r.status === "error") {
|
if (r.status === "error") {
|
||||||
toast.error("Failed to set disk");
|
toast.error("Failed to set disk");
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
|
|
||||||
let
|
|
||||||
suffix = config.clan.core.machine.diskId;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
boot.loader.grub.efiSupport = lib.mkDefault true;
|
boot.loader.grub.efiSupport = lib.mkDefault true;
|
||||||
boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true;
|
boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true;
|
||||||
@@ -15,12 +11,12 @@ in
|
|||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
partitions = {
|
partitions = {
|
||||||
"boot-${suffix}" = {
|
"boot" = {
|
||||||
size = "1M";
|
size = "1M";
|
||||||
type = "EF02"; # for grub MBR
|
type = "EF02"; # for grub MBR
|
||||||
priority = 1;
|
priority = 1;
|
||||||
};
|
};
|
||||||
"ESP-${suffix}" = {
|
"ESP" = {
|
||||||
size = "512M";
|
size = "512M";
|
||||||
type = "EF00";
|
type = "EF00";
|
||||||
content = {
|
content = {
|
||||||
@@ -29,7 +25,7 @@ in
|
|||||||
mountpoint = "/boot";
|
mountpoint = "/boot";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"root-${suffix}" = {
|
"root" = {
|
||||||
size = "100%";
|
size = "100%";
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "filesystem";
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
|
|
||||||
let
|
|
||||||
suffix = config.clan.core.machine.diskId;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
# TO NOT EDIT THIS FILE AFTER INSTALLATION of a machine
|
# TO NOT EDIT THIS FILE AFTER INSTALLATION of a machine
|
||||||
# Otherwise your system might not boot because of missing partitions / filesystems
|
# Otherwise your system might not boot because of missing partitions / filesystems
|
||||||
@@ -17,12 +13,12 @@ in
|
|||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
partitions = {
|
partitions = {
|
||||||
"boot-${suffix}" = {
|
"boot" = {
|
||||||
size = "1M";
|
size = "1M";
|
||||||
type = "EF02"; # for grub MBR
|
type = "EF02"; # for grub MBR
|
||||||
priority = 1;
|
priority = 1;
|
||||||
};
|
};
|
||||||
"ESP-${suffix}" = {
|
"ESP" = {
|
||||||
size = "512M";
|
size = "512M";
|
||||||
type = "EF00";
|
type = "EF00";
|
||||||
content = {
|
content = {
|
||||||
@@ -32,7 +28,7 @@ in
|
|||||||
mountOptions = [ "nofail" ];
|
mountOptions = [ "nofail" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"root-${suffix}" = {
|
"root" = {
|
||||||
size = "100%";
|
size = "100%";
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "filesystem";
|
||||||
|
|||||||
Reference in New Issue
Block a user