diff --git a/clanModules/flake-module.nix b/clanModules/flake-module.nix index a7adac70..8bc1c152 100644 --- a/clanModules/flake-module.nix +++ b/clanModules/flake-module.nix @@ -7,6 +7,7 @@ ergochat = ./ergochat; localbackup = ./localbackup; localsend = ./localsend; + single-disk = ./single-disk; matrix-synapse = ./matrix-synapse; moonlight = ./moonlight; postgresql = ./postgresql; diff --git a/clanModules/single-disk/README.md b/clanModules/single-disk/README.md new file mode 100644 index 00000000..9aa6e4f9 --- /dev/null +++ b/clanModules/single-disk/README.md @@ -0,0 +1,42 @@ +--- +description = "Configures partitioning of the main disk" +categories = ["disk-layout"] +--- +# Primary Disk Layout + +A module for the "disk-layout" category MUST be choosen. + +There is exactly one slot for this type of module in the UI, if you don't fill the slot, your machine cannot boot + +This module is a good choice for most machines. In the future clan will offer a broader choice of disk-layouts + +The UI will ask for the options of this module: + +`device: "/dev/null"` + +# Usage example + +`inventory.json` +```json +"services": { + "single-disk": { + "default": { + "meta": { + "name": "single-disk" + }, + "roles": { + "default": { + "machines": ["jon"] + } + }, + "machines": { + "jon": { + "config": { + "device": "/dev/null" + } + } + } + } + } +} +``` \ No newline at end of file diff --git a/clanModules/single-disk/default.nix b/clanModules/single-disk/default.nix new file mode 100644 index 00000000..142c5ded --- /dev/null +++ b/clanModules/single-disk/default.nix @@ -0,0 +1,52 @@ +{ lib, config, ... }: +{ + options.clan.single-disk = { + device = lib.mkOption { + type = lib.types.str; + description = "The primary disk device to install the system on"; + # Question: should we set a default here? + # default = "/dev/null"; + }; + }; + 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; + }; + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/clanModules/single-disk/roles/default.nix b/clanModules/single-disk/roles/default.nix new file mode 100644 index 00000000..ffcd4415 --- /dev/null +++ b/clanModules/single-disk/roles/default.nix @@ -0,0 +1 @@ +{ } diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 9be53df1..beb534e4 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -61,6 +61,7 @@ nav: - reference/clanModules/moonlight.md - reference/clanModules/postgresql.md - reference/clanModules/root-password.md + - reference/clanModules/single-disk.md - reference/clanModules/sshd.md - reference/clanModules/static-hosts.md - reference/clanModules/sunshine.md diff --git a/inventory.json b/inventory.json index 7300779f..d86c13ce 100644 --- a/inventory.json +++ b/inventory.json @@ -8,5 +8,25 @@ "tags": ["1", "2", "3"] } }, - "services": {} + "services": { + "single-disk": { + "default": { + "meta": { + "name": "single-disk" + }, + "roles": { + "default": { + "machines": ["minimal-inventory-machine"] + } + }, + "machines": { + "minimal-inventory-machine": { + "config": { + "device": "/dev/null" + } + } + } + } + } + } } diff --git a/lib/facts.nix b/lib/facts.nix index 5ba36b5d..ac72f250 100644 --- a/lib/facts.nix +++ b/lib/facts.nix @@ -59,7 +59,6 @@ let ) machinesFactsAttrs; in filteredMachineFactAttrs; - in { inherit diff --git a/machines/minimal-inventory-machine/README.md b/machines/minimal-inventory-machine/README.md deleted file mode 100644 index e5151b35..00000000 --- a/machines/minimal-inventory-machine/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This settings exists only for testing purpose to make the machine bootable - -It serves as a gap close, until we have the required boot and filesystem modules ready for the inventory. \ No newline at end of file diff --git a/machines/minimal-inventory-machine/settings.json b/machines/minimal-inventory-machine/settings.json deleted file mode 100644 index 6e47781a..00000000 --- a/machines/minimal-inventory-machine/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "fileSystems": { "/": { "device": "/dev/null" } }, - "boot": { "loader": { "grub": { "device": "/dev/null" } } } -} diff --git a/pkgs/matrix-bot/default.nix b/pkgs/matrix-bot/default.nix index d1459360..f6244c0f 100644 --- a/pkgs/matrix-bot/default.nix +++ b/pkgs/matrix-bot/default.nix @@ -20,7 +20,6 @@ let runtimeDependencies = [ ]; testDependencies = pythonDependencies ++ runtimeDependencies ++ [ ]; - in python3.pkgs.buildPythonApplication { name = "matrix-bot";