From 5cf5bf52b742b10a0a4c168e740ab7b274d60439 Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Tue, 10 Oct 2023 17:57:25 +0200 Subject: [PATCH] flake: Add output for `options.json` --- flake.nix | 20 +++++++++++++++++++- modules/kbin.nix | 1 + modules/pretalx.nix | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index e30d0c3b0..61cddba25 100644 --- a/flake.nix +++ b/flake.nix @@ -108,8 +108,26 @@ pkgs = importNixpkgs system [rust-overlay.overlays.default]; treefmtEval = loadTreefmt pkgs; toplevel = name: config: nameValuePair "nixosConfigs/${name}" config.config.system.build.toplevel; + + dummy = import (nixpkgs + "/nixos/lib/eval-config.nix") { + inherit system; + modules = builtins.attrValues self.nixosModules ++ [ + { + networking = { + domain = "invalid"; + hostName = "options"; + }; + } + ]; + }; + options = builtins.mapAttrs (name: _: dummy.options.services.${name} or {}) self.nixosModules; in { - packages = importPackages pkgs; + packages = (importPackages pkgs) // { + options = pkgs.runCommand "options.json" { + build = (pkgs.nixosOptionsDoc { inherit options; }).optionsJSON; + } "cp $build/share/doc/nixos/options.json $out"; + }; + formatter = treefmtEval.config.build.wrapper; checks = mapAttrs' toplevel nixosConfigurations; }); diff --git a/modules/kbin.nix b/modules/kbin.nix index 215b1474c..e30241fc5 100644 --- a/modules/kbin.nix +++ b/modules/kbin.nix @@ -100,6 +100,7 @@ in { }; secrets = mkOption { + description = "Paths to files containing secrets, keyed by the respective environment variable."; type = submodule { freeformType = attrsOf (nullOr path); diff --git a/modules/pretalx.nix b/modules/pretalx.nix index 0d10ce56e..e167be0f0 100644 --- a/modules/pretalx.nix +++ b/modules/pretalx.nix @@ -14,6 +14,7 @@ inherit (lib) + literalExpression optionals modules types @@ -201,6 +202,7 @@ in { type = nullOr str; default = null; example = "pretalx"; + description = "Database user that pretalx should connect as."; }; passwordFile = mkOption {