Add disko config for server10, add glotzbert back, don't configure fileSystems
This commit is contained in:
parent
e9a4c3de11
commit
f89a5fb24e
|
@ -19,6 +19,13 @@
|
|||
systemd-boot.enable = true;
|
||||
};
|
||||
|
||||
disko.disks = [ {
|
||||
device = "/dev/disk/by-id/ata-SSD0240S00_20201124BC41037";
|
||||
name = "glotzbert";
|
||||
withCeph = false;
|
||||
withLuks = false;
|
||||
} ];
|
||||
|
||||
networking = {
|
||||
domain = "hq.c3d2.de";
|
||||
firewall = {
|
||||
|
|
|
@ -28,6 +28,14 @@
|
|||
};
|
||||
};
|
||||
|
||||
disko.disks = [ {
|
||||
device = "/dev/disk/by-id/ata-Samsung_SSD_860_EVO_1TB_S3Z9NB0M203733F";
|
||||
name = "server10";
|
||||
partitionTableFormat = "msdos";
|
||||
withBoot = true;
|
||||
withLuks = true;
|
||||
} ];
|
||||
|
||||
networking = {
|
||||
hostName = "server10";
|
||||
# TODO: change that to something more random
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.disko;
|
||||
cfg = config.disko.disks;
|
||||
in
|
||||
{
|
||||
options.disko.disks = lib.mkOption {
|
||||
|
@ -22,6 +22,12 @@ in
|
|||
description = "Name of the disk.";
|
||||
};
|
||||
|
||||
partitionTableFormat = lib.mkOption {
|
||||
type = lib.types.enum [ "gpt" "msdos" ];
|
||||
default = "gpt";
|
||||
description = "Which parition table format to use.";
|
||||
};
|
||||
|
||||
withBoot = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
|
@ -30,7 +36,7 @@ in
|
|||
|
||||
withCeph = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
default = false;
|
||||
description = "Wether to include a ceph partition.";
|
||||
};
|
||||
|
||||
|
@ -51,7 +57,7 @@ in
|
|||
};
|
||||
|
||||
config = {
|
||||
assertions = lib.mkIf (cfg.disks != [ ]) (lib.head (map
|
||||
assertions = lib.mkIf (cfg != [ ]) (lib.head (map
|
||||
(disk: [
|
||||
{
|
||||
assertion = disk.withCeph || disk.withZfs;
|
||||
|
@ -62,9 +68,10 @@ in
|
|||
message = "Ceph requires Luks!";
|
||||
}
|
||||
])
|
||||
cfg.disks));
|
||||
cfg));
|
||||
|
||||
disko.devices = lib.mkIf (cfg.disks != [ ]) (lib.head (map
|
||||
disko = {
|
||||
devices = lib.mkIf (cfg != [ ]) (lib.head (map
|
||||
(disk:
|
||||
let
|
||||
diskName = if disk.name != "" then "-${disk.name}" else "";
|
||||
|
@ -84,7 +91,7 @@ in
|
|||
type = "disk";
|
||||
content = {
|
||||
type = "table";
|
||||
format = "gpt";
|
||||
format = disk.partitionTableFormat;
|
||||
partitions = lib.optional disk.withZfs {
|
||||
name = "ESP";
|
||||
start = "1MiB";
|
||||
|
@ -104,8 +111,7 @@ in
|
|||
content = lib.optionalAttrs disk.withLuks {
|
||||
type = "luks";
|
||||
name = luksName;
|
||||
# trim potential new lines to not have them in the password
|
||||
keyFile = "tr -d '\n' </$PWD/keyFile";
|
||||
askPassword = true;
|
||||
inherit (zfs) content;
|
||||
} // lib.optionalAttrs (!disk.withLuks) zfs.content;
|
||||
}
|
||||
|
@ -174,6 +180,10 @@ in
|
|||
};
|
||||
};
|
||||
})
|
||||
cfg.disks));
|
||||
cfg));
|
||||
|
||||
# we do not want changes to this module render machines unbootable
|
||||
enableConfig = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue