diff --git a/checks/installation/flake-module.nix b/checks/installation/flake-module.nix index 7fb1ee8bf..ecfcd7b2d 100644 --- a/checks/installation/flake-module.nix +++ b/checks/installation/flake-module.nix @@ -12,11 +12,11 @@ { lib, modulesPath, ... }: { imports = [ - "${self}/nixosModules/disk-layouts" + self.clanModules.single-disk (modulesPath + "/testing/test-instrumentation.nix") # we need these 2 modules always to be able to run the tests (modulesPath + "/profiles/qemu-guest.nix") ]; - clan.disk-layouts.singleDiskExt4.device = "/dev/vdb"; + clan.single-disk.device = "/dev/vdb"; environment.etc."install-successful".text = "ok"; diff --git a/clanModules/single-disk/default.nix b/clanModules/single-disk/default.nix index eb90daf05..6a9d8e01a 100644 --- a/clanModules/single-disk/default.nix +++ b/clanModules/single-disk/default.nix @@ -22,12 +22,12 @@ content = { type = "gpt"; partitions = { - boot = { + "${config.networking.hostName}-boot" = { size = "1M"; type = "EF02"; # for grub MBR priority = 1; }; - ESP = { + "${config.networking.hostName}-ESP" = { size = "512M"; type = "EF00"; content = { @@ -36,7 +36,7 @@ mountpoint = "/boot"; }; }; - root = { + "${config.networking.hostName}-root" = { size = "100%"; content = { type = "filesystem"; diff --git a/docs/site/getting-started/disk-encryption.md b/docs/site/getting-started/disk-encryption.md index 59ca948e8..8217ef761 100644 --- a/docs/site/getting-started/disk-encryption.md +++ b/docs/site/getting-started/disk-encryption.md @@ -23,12 +23,12 @@ lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT content = { type = "gpt"; partitions = { - boot = { + "${config.networking.hostName}-boot" = { size = "1M"; type = "EF02"; # for grub MBR priority = 1; }; - ESP = lib.mkIf (idx == "nvme-eui.002538b931b59865") { + "${config.networking.hostName}-ESP" = lib.mkIf (idx == "nvme-eui.002538b931b59865") { size = "1G"; type = "EF00"; content = { @@ -38,7 +38,7 @@ lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT mountOptions = [ "nofail" ]; }; }; - zfs = { + "${config.networking.hostName}-root" = { size = "100%"; content = { type = "zfs"; diff --git a/nixosModules/disk-layouts/default.nix b/nixosModules/disk-layouts/default.nix deleted file mode 100644 index b2e5f1306..000000000 --- a/nixosModules/disk-layouts/default.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ config, lib, ... }: -{ - options.clan.disk-layouts.singleDiskExt4 = { - device = lib.mkOption { - type = lib.types.str; - example = "/dev/disk/by-id/ata-Samsung_SSD_850_EVO_250GB_S21PNXAGB12345"; - }; - }; - config = { - boot.loader.grub.efiSupport = lib.mkDefault true; - boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true; - disko.devices = { - disk = { - main = { - type = "disk"; - device = config.clan.disk-layouts.singleDiskExt4.device; - content = { - type = "gpt"; - partitions = { - boot = { - size = "1M"; - type = "EF02"; # for grub MBR - priority = 1; - }; - ESP = { - size = "512M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; - root = { - size = "100%"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - }; - }; - }; - }; - }; - }; - }; - }; -} diff --git a/nixosModules/flake-module.nix b/nixosModules/flake-module.nix index 32ff61eae..1977b9bf3 100644 --- a/nixosModules/flake-module.nix +++ b/nixosModules/flake-module.nix @@ -14,7 +14,6 @@ inputs.sops-nix.nixosModules.sops inputs.disko.nixosModules.default ./clanCore - ./iso ( { pkgs, lib, ... }: { diff --git a/nixosModules/iso/default.nix b/nixosModules/iso/default.nix deleted file mode 100644 index 5a0a2e416..000000000 --- a/nixosModules/iso/default.nix +++ /dev/null @@ -1,89 +0,0 @@ -{ - config, - extendModules, - lib, - pkgs, - ... -}: -let - # Generates a fileSystems entry for bind mounting a given state folder path - # It binds directories from /var/clanstate/{some-path} to /{some-path}. - # As a result, all state paths will be persisted across reboots, because - # the state folder is mounted from the host system. - mkBindMount = path: { - name = path; - value = { - device = "/var/clanstate/${path}"; - options = [ "bind" ]; - }; - }; - - # Flatten the list of state folders into a single list - stateFolders = lib.flatten ( - lib.mapAttrsToList (_item: attrs: attrs.folders) config.clan.core.state - ); - - # A module setting up bind mounts for all state folders - stateMounts = { - fileSystems = lib.listToAttrs (map mkBindMount stateFolders); - }; - - isoModule = - { config, ... }: - { - imports = [ stateMounts ]; - options.clan.iso.disko = lib.mkOption { - type = lib.types.submodule { freeformType = (pkgs.formats.json { }).type; }; - default = { - disk = { - iso = { - type = "disk"; - imageSize = "10G"; # TODO add auto image size in disko - content = { - type = "gpt"; - partitions = { - boot = { - size = "1M"; - type = "EF02"; # for grub MBR - priority = 1; # Needs to be first partition - }; - ESP = { - size = "100M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; - root = { - size = "100%"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - }; - }; - }; - }; - }; - }; - }; - }; - config = { - disko.devices = lib.mkOverride 51 config.clan.iso.disko; - boot.loader.grub.enable = true; - boot.loader.grub.efiSupport = true; - boot.loader.grub.device = lib.mkForce "/dev/vda"; - boot.loader.grub.efiInstallAsRemovable = true; - }; - }; - - isoConfig = extendModules { modules = [ isoModule ]; }; -in -{ - config = { - # for clan vm create - system.clan.iso = isoConfig.config.system.build.diskoImages; - }; -} diff --git a/templates/flake-parts/modules/disko.nix b/templates/flake-parts/modules/disko.nix index 7a7509584..34a989f02 100644 --- a/templates/flake-parts/modules/disko.nix +++ b/templates/flake-parts/modules/disko.nix @@ -11,12 +11,12 @@ content = { type = "gpt"; partitions = { - boot = { + "${config.networking.hostName}-boot" = { size = "1M"; type = "EF02"; # for grub MBR priority = 1; }; - ESP = { + "${config.networking.hostName}-ESP" = { size = "512M"; type = "EF00"; content = { @@ -25,7 +25,7 @@ mountpoint = "/boot"; }; }; - root = { + "${config.networking.hostName}-root" = { size = "100%"; content = { type = "filesystem"; diff --git a/templates/new-clan/modules/disko.nix b/templates/new-clan/modules/disko.nix index a1802a33a..52fce9c4c 100644 --- a/templates/new-clan/modules/disko.nix +++ b/templates/new-clan/modules/disko.nix @@ -13,12 +13,12 @@ content = { type = "gpt"; partitions = { - boot = { + "${config.networking.hostName}-boot" = { size = "1M"; type = "EF02"; # for grub MBR priority = 1; }; - ESP = { + "${config.networking.hostName}-ESP" = { size = "512M"; type = "EF00"; content = { @@ -28,7 +28,7 @@ mountOptions = [ "nofail" ]; }; }; - root = { + "${config.networking.hostName}-root" = { size = "100%"; content = { type = "filesystem";