Skip to content

Commit

Permalink
flake: Add output for options.json
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzleutgeb committed Mar 22, 2024
1 parent 5cee918 commit 5cf5bf5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
20 changes: 19 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
1 change: 1 addition & 0 deletions modules/kbin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions modules/pretalx.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

inherit
(lib)
literalExpression
optionals
modules
types
Expand Down Expand Up @@ -201,6 +202,7 @@ in {
type = nullOr str;
default = null;
example = "pretalx";
description = "Database user that pretalx should connect as.";
};

passwordFile = mkOption {
Expand Down

0 comments on commit 5cf5bf5

Please sign in to comment.