diff --git a/checks/service-dummy-test-from-flake/default.nix b/checks/service-dummy-test-from-flake/default.nix index 324e2f087..afdf04395 100644 --- a/checks/service-dummy-test-from-flake/default.nix +++ b/checks/service-dummy-test-from-flake/default.nix @@ -16,7 +16,6 @@ nixosLib.runTest ( # This tests the compatibility of the inventory # With the test framework - # - legacy-modules # - clan.service modules name = "service-dummy-test-from-flake"; @@ -45,9 +44,6 @@ nixosLib.runTest ( start_all() admin1.wait_for_unit("multi-user.target") peer1.wait_for_unit("multi-user.target") - # Provided by the legacy module - print(admin1.succeed("systemctl status dummy-service")) - print(peer1.succeed("systemctl status dummy-service")) # peer1 should have the 'hello' file peer1.succeed("cat ${nodes.peer1.clan.core.vars.generators.new-service.files.not-a-secret.path}") diff --git a/checks/service-dummy-test-from-flake/flake.nix b/checks/service-dummy-test-from-flake/flake.nix index 15294917b..c6d959822 100644 --- a/checks/service-dummy-test-from-flake/flake.nix +++ b/checks/service-dummy-test-from-flake/flake.nix @@ -15,12 +15,6 @@ meta.name = "foo"; machines.peer1 = { }; machines.admin1 = { }; - services = { - legacy-module.default = { - roles.peer.machines = [ "peer1" ]; - roles.admin.machines = [ "admin1" ]; - }; - }; instances."test" = { module.name = "new-service"; @@ -28,9 +22,6 @@ roles.peer.machines.peer1 = { }; }; - modules = { - legacy-module = ./legacy-module; - }; }; modules.new-service = { diff --git a/checks/service-dummy-test-from-flake/legacy-module/README.md b/checks/service-dummy-test-from-flake/legacy-module/README.md deleted file mode 100644 index 2a72080ce..000000000 --- a/checks/service-dummy-test-from-flake/legacy-module/README.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -description = "Set up dummy-module" -categories = ["System"] -features = [ "inventory" ] - -[constraints] -roles.admin.min = 1 -roles.admin.max = 1 ---- - diff --git a/checks/service-dummy-test-from-flake/legacy-module/roles/admin.nix b/checks/service-dummy-test-from-flake/legacy-module/roles/admin.nix deleted file mode 100644 index a56780406..000000000 --- a/checks/service-dummy-test-from-flake/legacy-module/roles/admin.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - imports = [ - ../shared.nix - ]; -} diff --git a/checks/service-dummy-test-from-flake/legacy-module/roles/peer.nix b/checks/service-dummy-test-from-flake/legacy-module/roles/peer.nix deleted file mode 100644 index a56780406..000000000 --- a/checks/service-dummy-test-from-flake/legacy-module/roles/peer.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - imports = [ - ../shared.nix - ]; -} diff --git a/checks/service-dummy-test-from-flake/legacy-module/shared.nix b/checks/service-dummy-test-from-flake/legacy-module/shared.nix deleted file mode 100644 index 92b7418ca..000000000 --- a/checks/service-dummy-test-from-flake/legacy-module/shared.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ config, ... }: -{ - systemd.services.dummy-service = { - enable = true; - description = "Dummy service"; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = true; - }; - script = '' - generated_password_path="${config.clan.core.vars.generators.dummy-generator.files.generated-password.path}" - if [ ! -f "$generated_password_path" ]; then - echo "Generated password file not found: $generated_password_path" - exit 1 - fi - host_id_path="${config.clan.core.vars.generators.dummy-generator.files.host-id.path}" - if [ ! -e "$host_id_path" ]; then - echo "Host ID file not found: $host_id_path" - exit 1 - fi - ''; - }; - - # TODO: add and prompt and make it work in the test framework - clan.core.vars.generators.dummy-generator = { - files.host-id.secret = false; - files.generated-password.secret = true; - script = '' - echo $RANDOM > "$out"/host-id - echo $RANDOM > "$out"/generated-password - ''; - }; -} diff --git a/checks/service-dummy-test/default.nix b/checks/service-dummy-test/default.nix index a771cb541..263133f3a 100644 --- a/checks/service-dummy-test/default.nix +++ b/checks/service-dummy-test/default.nix @@ -15,7 +15,6 @@ nixosLib.runTest ( # This tests the compatibility of the inventory # With the test framework - # - legacy-modules # - clan.service modules name = "service-dummy-test"; @@ -24,12 +23,6 @@ nixosLib.runTest ( inventory = { machines.peer1 = { }; machines.admin1 = { }; - services = { - legacy-module.default = { - roles.peer.machines = [ "peer1" ]; - roles.admin.machines = [ "admin1" ]; - }; - }; instances."test" = { module.name = "new-service"; @@ -37,9 +30,6 @@ nixosLib.runTest ( roles.peer.machines.peer1 = { }; }; - modules = { - legacy-module = ./legacy-module; - }; }; modules.new-service = { _class = "clan.service"; @@ -78,9 +68,6 @@ nixosLib.runTest ( start_all() admin1.wait_for_unit("multi-user.target") peer1.wait_for_unit("multi-user.target") - # Provided by the legacy module - print(admin1.succeed("systemctl status dummy-service")) - print(peer1.succeed("systemctl status dummy-service")) # peer1 should have the 'hello' file peer1.succeed("cat ${nodes.peer1.clan.core.vars.generators.new-service.files.not-a-secret.path}") diff --git a/clanModules/flake-module.nix b/clanModules/flake-module.nix index 13294371d..d37aa27c8 100644 --- a/clanModules/flake-module.nix +++ b/clanModules/flake-module.nix @@ -6,48 +6,6 @@ let Refer to https://docs.clan.lol/guides/migrations/migrate-inventory-services for migration. ''; - - modnames = [ - "auto-upgrade" - "admin" - "borgbackup" - "borgbackup-static" - "deltachat" - "data-mesher" - "disk-id" - "dyndns" - "ergochat" - "garage" - "heisenbridge" - "importer" - "iwd" - "localbackup" - "localsend" - "matrix-synapse" - "moonlight" - "mumble" - "mycelium" - "nginx" - "packages" - "postgresql" - "root-password" - "single-disk" - "sshd" - "state-version" - "static-hosts" - "sunshine" - "syncthing" - "syncthing-static-peers" - "thelounge" - "trusted-nix-caches" - "user-password" - "vaultwarden" - "wifi" - "xfce" - "zerotier" - "zerotier-static-peers" - "zt-tcp-relay" - ]; in { diff --git a/docs/nix/flake-module.nix b/docs/nix/flake-module.nix index 9fd08108e..17467463a 100644 --- a/docs/nix/flake-module.nix +++ b/docs/nix/flake-module.nix @@ -36,9 +36,6 @@ in docs.optionsJSON; - # Options available via ` imports = [ clanModules.${moduleName} ]; ` (Direct nix import) - clanModulesViaNix = pkgs.writeText "info.json" (builtins.toJSON jsonDocs.clanModulesViaNix); - # Options available when imported via ` inventory.${moduleName}....${rolesName} ` clanModulesViaRoles = pkgs.writeText "info.json" (builtins.toJSON jsonDocs.clanModulesViaRoles); @@ -94,7 +91,6 @@ # A file that contains the links to all clanModule docs export CLAN_MODULES_VIA_ROLES=${clanModulesViaRoles} export CLAN_MODULES_VIA_SERVICE=${clanModulesViaService} - export CLAN_MODULES_VIA_NIX=${clanModulesViaNix} export CLAN_SERVICE_INTERFACE=${self'.legacyPackages.clan-service-module-interface}/share/doc/nixos/options.json # Frontmatter format for clanModules export CLAN_MODULES_FRONTMATTER_DOCS=${clanModulesFrontmatter}/share/doc/nixos/options.json @@ -111,7 +107,6 @@ legacyPackages = { inherit jsonDocs - clanModulesViaNix clanModulesViaRoles clanModulesViaService ; diff --git a/docs/nix/get-module-docs.nix b/docs/nix/get-module-docs.nix index d6bc0e917..a58ce69ff 100644 --- a/docs/nix/get-module-docs.nix +++ b/docs/nix/get-module-docs.nix @@ -1,34 +1,17 @@ { modulesRolesOptions, nixosOptionsDoc, - clanModules, evalClanModules, lib, pkgs, clan-core, + ... }: let inherit (clan-core.clanLib.docs) stripStorePathsFromDeclarations; transformOptions = stripStorePathsFromDeclarations; in { - # clanModules docs - clanModulesViaNix = lib.mapAttrs ( - name: module: - if builtins.pathExists (module + "/default.nix") then - (nixosOptionsDoc { - options = - ((evalClanModules { - modules = [ module ]; - inherit pkgs clan-core; - }).options - ).clan.${name} or { }; - warningsAreErrors = true; - inherit transformOptions; - }).optionsJSON - else - { } - ) clanModules; clanModulesViaRoles = lib.mapAttrs ( _moduleName: rolesOptions: diff --git a/lib/modules/inventory/frontmatter/default.nix b/lib/modules/inventory/frontmatter/default.nix index 383779b99..4c14216a1 100644 --- a/lib/modules/inventory/frontmatter/default.nix +++ b/lib/modules/inventory/frontmatter/default.nix @@ -121,45 +121,7 @@ let ); checkConstraints = args: (evalFrontmatter args).config.constraints.assertions; - - getReadme = - modulepath: modulename: - let - readme = modulepath + "/README.md"; - readmeContents = - if (builtins.pathExists readme) then - (builtins.readFile readme) - else - throw "No README.md found for module ${modulename} (expected at ${readme})"; - in - readmeContents; - - getFrontmatter = - modulepath: modulename: - let - content = getReadme modulepath modulename; - parts = lib.splitString "---" content; - # Partition the parts into the first part (the readme content) and the rest (the metadata) - parsed = builtins.partition ({ index, ... }: if index >= 2 then false else true) ( - lib.filter ({ index, ... }: index != 0) (lib.imap0 (index: part: { inherit index part; }) parts) - ); - meta = builtins.fromTOML (builtins.head parsed.right).part; - in - if (builtins.length parts >= 3) then - meta - else - throw '' - TOML Frontmatter not found in README.md for module ${modulename} - - Please add the following to the top of your README.md: - - --- - description = "Your description here" - categories = [ "Your categories here" ] - features = [ "inventory" ] - --- - ...rest of your README.md... - ''; + getFrontmatter = _modulepath: _modulename: "clanModules are removed!"; in { inherit diff --git a/lib/modules/inventoryClass/interface.nix b/lib/modules/inventoryClass/interface.nix index 60a453f03..233c53784 100644 --- a/lib/modules/inventoryClass/interface.nix +++ b/lib/modules/inventoryClass/interface.nix @@ -161,7 +161,7 @@ in ``` ''; - apply =_: {}; + apply = _: { }; }; assertions = lib.mkOption {