docs: render module options docs
fix errors while rendering some modules
This commit is contained in:
parent
ec105d8ef8
commit
e0bdf1ce39
|
@ -28,6 +28,7 @@ in
|
||||||
default = "ssh -i ${
|
default = "ssh -i ${
|
||||||
config.clanCore.facts.services.borgbackup.secret."borgbackup.ssh".path
|
config.clanCore.facts.services.borgbackup.secret."borgbackup.ssh".path
|
||||||
} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null";
|
} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null";
|
||||||
|
defaultText = "ssh -i \${config.clanCore.facts.services.borgbackup.secret.\"borgbackup.ssh\".path} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null";
|
||||||
description = "the rsh to use for the backup";
|
description = "the rsh to use for the backup";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,10 +17,7 @@
|
||||||
package = lib.mkPackageOption pkgs "localsend" { };
|
package = lib.mkPackageOption pkgs "localsend" { };
|
||||||
};
|
};
|
||||||
|
|
||||||
imports =
|
config = lib.mkIf config.clan.localsend.enable {
|
||||||
if config.clan.localsend.enable then
|
|
||||||
[
|
|
||||||
{
|
|
||||||
clanCore.state.localsend.folders = [
|
clanCore.state.localsend.folders = [
|
||||||
"/var/localsend"
|
"/var/localsend"
|
||||||
config.clan.localsend.defaultLocation
|
config.clan.localsend.defaultLocation
|
||||||
|
@ -37,8 +34,5 @@
|
||||||
Address = "192.168.56.2/24";
|
Address = "192.168.56.2/24";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
]
|
|
||||||
else
|
|
||||||
[ ];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
type = lib.types.nullOr lib.types.str;
|
type = lib.types.nullOr lib.types.str;
|
||||||
example = "BABNJY4-G2ICDLF-QQEG7DD-N3OBNGF-BCCOFK6-MV3K7QJ-2WUZHXS-7DTW4AS";
|
example = "BABNJY4-G2ICDLF-QQEG7DD-N3OBNGF-BCCOFK6-MV3K7QJ-2WUZHXS-7DTW4AS";
|
||||||
default = config.clanCore.facts.services.syncthing.public."syncthing.pub".value or null;
|
default = config.clanCore.facts.services.syncthing.public."syncthing.pub".value or null;
|
||||||
|
defaultText = "config.clanCore.facts.services.syncthing.public.\"syncthing.pub\".value";
|
||||||
};
|
};
|
||||||
introducer = lib.mkOption {
|
introducer = lib.mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
|
|
72
docs/flake-module.nix
Normal file
72
docs/flake-module.nix
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
lib,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
perSystem =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
|
||||||
|
allNixosModules = (import "${inputs.nixpkgs}/nixos/modules/module-list.nix") ++ [
|
||||||
|
"${inputs.nixpkgs}/nixos/modules/misc/assertions.nix"
|
||||||
|
{ nixpkgs.hostPlatform = "x86_64-linux"; }
|
||||||
|
];
|
||||||
|
|
||||||
|
clanCoreNixosModules = [ self.nixosModules.clanCore ] ++ allNixosModules;
|
||||||
|
|
||||||
|
# options = modules: (inputs.nixpkgs.legacyPackages.x86_64-linux.nixos { imports = modules; }).options;
|
||||||
|
options =
|
||||||
|
modules:
|
||||||
|
(lib.evalModules {
|
||||||
|
modules = modules;
|
||||||
|
# modules = modules ++ ["${inputs.nixpkgs}/nixos/modules/misc/assertions.nix"];
|
||||||
|
# specialArgs = { pkgs = pkgs; };
|
||||||
|
}).options;
|
||||||
|
|
||||||
|
docs =
|
||||||
|
options:
|
||||||
|
pkgs.nixosOptionsDoc {
|
||||||
|
options = options;
|
||||||
|
warningsAreErrors = false;
|
||||||
|
transformOptions =
|
||||||
|
opt:
|
||||||
|
opt
|
||||||
|
// {
|
||||||
|
declarations = lib.forEach opt.declarations (
|
||||||
|
decl:
|
||||||
|
if lib.hasPrefix "${self}" decl then
|
||||||
|
let
|
||||||
|
subpath = lib.removePrefix "${self}" decl;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
url = "https://git.clan.lol/clan/clan-core/src/branch/main/" + subpath;
|
||||||
|
name = subpath;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
decl
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputsFor = name: docs: { packages."docs-md-${name}" = docs.optionsCommonMark; };
|
||||||
|
|
||||||
|
clanModulesPages = lib.flip lib.mapAttrsToList self.clanModules (
|
||||||
|
name: module:
|
||||||
|
outputsFor "module-${name}" (
|
||||||
|
docs (options ([ module ] ++ clanCoreNixosModules)).clan.${name} or { }
|
||||||
|
)
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
clanModulesPages
|
||||||
|
# uncomment to render clanCore top-level options as extra pages
|
||||||
|
# ++ clanCorePages
|
||||||
|
++ [
|
||||||
|
# renders all clanCore options as a single page
|
||||||
|
(outputsFor "core-options" (docs (options clanCoreNixosModules).clanCore))
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
11
flake.nix
11
flake.nix
|
@ -34,15 +34,14 @@
|
||||||
];
|
];
|
||||||
imports = [
|
imports = [
|
||||||
./checks/flake-module.nix
|
./checks/flake-module.nix
|
||||||
./devShell.nix
|
|
||||||
./formatter.nix
|
|
||||||
./templates/flake-module.nix
|
|
||||||
./clanModules/flake-module.nix
|
./clanModules/flake-module.nix
|
||||||
|
./devShell.nix
|
||||||
./pkgs/flake-module.nix
|
./docs/flake-module.nix
|
||||||
|
./formatter.nix
|
||||||
./lib/flake-module.nix
|
./lib/flake-module.nix
|
||||||
./nixosModules/flake-module.nix
|
./nixosModules/flake-module.nix
|
||||||
|
./pkgs/flake-module.nix
|
||||||
|
./templates/flake-module.nix
|
||||||
{
|
{
|
||||||
options.flake = flake-parts.lib.mkSubmoduleOptions {
|
options.flake = flake-parts.lib.mkSubmoduleOptions {
|
||||||
clanInternals = lib.mkOption {
|
clanInternals = lib.mkOption {
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
options.clanCore.secrets = lib.mkOption {
|
options.clanCore.secrets = lib.mkOption {
|
||||||
|
visible = false;
|
||||||
default = { };
|
default = { };
|
||||||
type = lib.types.attrsOf (
|
type = lib.types.attrsOf (
|
||||||
lib.types.submodule (service: {
|
lib.types.submodule (service: {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user