From 3771be21104f3c5257643a2917ad51dce052498f Mon Sep 17 00:00:00 2001 From: DavHau Date: Mon, 25 Mar 2024 14:44:39 +0700 Subject: [PATCH] checks: add check for rendering docs --- checks/flake-module.nix | 11 ++++++++++- nixosModules/clanCore/schema.nix | 1 + nixosModules/clanCore/secrets/default.nix | 2 ++ nixosModules/clanCore/zerotier/default.nix | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/checks/flake-module.nix b/checks/flake-module.nix index b0a2eb4e..00119bef 100644 --- a/checks/flake-module.nix +++ b/checks/flake-module.nix @@ -16,6 +16,15 @@ { checks = let + # ensure all options can be rendered after importing clan into nixos + renderClanOptions = + let + docs = pkgs.nixosOptionsDoc { + options = (pkgs.nixos { imports = [ self.nixosModules.clanCore ]; }).options; + warningsAreErrors = false; + }; + in + docs.optionsJSON; nixosTestArgs = { # reference to nixpkgs for the current system inherit pkgs; @@ -45,7 +54,7 @@ self'.legacyPackages.homeConfigurations or { } ); in - nixosTests // schemaTests // flakeOutputs; + { inherit renderClanOptions; } // nixosTests // schemaTests // flakeOutputs; legacyPackages = { nixosTests = let diff --git a/nixosModules/clanCore/schema.nix b/nixosModules/clanCore/schema.nix index b93d8642..4b5ad59a 100644 --- a/nixosModules/clanCore/schema.nix +++ b/nixosModules/clanCore/schema.nix @@ -7,5 +7,6 @@ in type = lib.types.attrs; description = "The json schema for the .clan options namespace"; default = jsonschema.parseOptions options.clan; + defaultText = lib.literalExpression "jsonschema.schemaToJSON options.clan"; }; } diff --git a/nixosModules/clanCore/secrets/default.nix b/nixosModules/clanCore/secrets/default.nix index 9f896b8c..b843d7f8 100644 --- a/nixosModules/clanCore/secrets/default.nix +++ b/nixosModules/clanCore/secrets/default.nix @@ -135,6 +135,7 @@ path to a secret which is generated by the generator ''; default = "${config'.clanCore.secretsDirectory}/${config'.clanCore.secretsPrefix}${config.name}"; + defaultText = lib.literalExpression "\${config'.clanCore.secretsDirectory}/\${config'.clanCore.secretsPrefix}\${config.name}"; }; } // lib.optionalAttrs (config'.clanCore.secretStore == "sops") { @@ -173,6 +174,7 @@ default = config.clanCore.clanDir + "/machines/${config.clanCore.machineName}/facts/${fact.config._module.args.name}"; + defaultText = lib.literalExpression "\${config.clanCore.clanDir}/machines/\${config.clanCore.machineName}/facts/\${fact.config._module.args.name}"; }; value = lib.mkOption { defaultText = lib.literalExpression "\${config.clanCore.clanDir}/\${fact.config.path}"; diff --git a/nixosModules/clanCore/zerotier/default.nix b/nixosModules/clanCore/zerotier/default.nix index 495394d2..726d4c52 100644 --- a/nixosModules/clanCore/zerotier/default.nix +++ b/nixosModules/clanCore/zerotier/default.nix @@ -24,6 +24,7 @@ in name = lib.mkOption { type = lib.types.str; default = config.clanCore.clanName; + defaultText = "config.clanCore.clanName"; description = '' zerotier network name '';