forked from clan/clan-core
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 ${
|
||||
config.clanCore.facts.services.borgbackup.secret."borgbackup.ssh".path
|
||||
} -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";
|
||||
};
|
||||
};
|
||||
|
@ -17,28 +17,22 @@
|
||||
package = lib.mkPackageOption pkgs "localsend" { };
|
||||
};
|
||||
|
||||
imports =
|
||||
if config.clan.localsend.enable then
|
||||
[
|
||||
{
|
||||
clanCore.state.localsend.folders = [
|
||||
"/var/localsend"
|
||||
config.clan.localsend.defaultLocation
|
||||
];
|
||||
environment.systemPackages = [ config.clan.localsend.package ];
|
||||
config = lib.mkIf config.clan.localsend.enable {
|
||||
clanCore.state.localsend.folders = [
|
||||
"/var/localsend"
|
||||
config.clan.localsend.defaultLocation
|
||||
];
|
||||
environment.systemPackages = [ config.clan.localsend.package ];
|
||||
|
||||
networking.firewall.interfaces."zt+".allowedTCPPorts = [ 53317 ];
|
||||
networking.firewall.interfaces."zt+".allowedUDPPorts = [ 53317 ];
|
||||
networking.firewall.interfaces."zt+".allowedTCPPorts = [ 53317 ];
|
||||
networking.firewall.interfaces."zt+".allowedUDPPorts = [ 53317 ];
|
||||
|
||||
#TODO: This is currently needed because there is no ipv6 multicasting support yet
|
||||
#
|
||||
systemd.network.networks."09-zerotier" = {
|
||||
networkConfig = {
|
||||
Address = "192.168.56.2/24";
|
||||
};
|
||||
};
|
||||
}
|
||||
]
|
||||
else
|
||||
[ ];
|
||||
#TODO: This is currently needed because there is no ipv6 multicasting support yet
|
||||
#
|
||||
systemd.network.networks."09-zerotier" = {
|
||||
networkConfig = {
|
||||
Address = "192.168.56.2/24";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
example = "BABNJY4-G2ICDLF-QQEG7DD-N3OBNGF-BCCOFK6-MV3K7QJ-2WUZHXS-7DTW4AS";
|
||||
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 {
|
||||
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 = [
|
||||
./checks/flake-module.nix
|
||||
./devShell.nix
|
||||
./formatter.nix
|
||||
./templates/flake-module.nix
|
||||
./clanModules/flake-module.nix
|
||||
|
||||
./pkgs/flake-module.nix
|
||||
|
||||
./devShell.nix
|
||||
./docs/flake-module.nix
|
||||
./formatter.nix
|
||||
./lib/flake-module.nix
|
||||
./nixosModules/flake-module.nix
|
||||
./pkgs/flake-module.nix
|
||||
./templates/flake-module.nix
|
||||
{
|
||||
options.flake = flake-parts.lib.mkSubmoduleOptions {
|
||||
clanInternals = lib.mkOption {
|
||||
|
@ -40,6 +40,7 @@
|
||||
)
|
||||
];
|
||||
options.clanCore.secrets = lib.mkOption {
|
||||
visible = false;
|
||||
default = { };
|
||||
type = lib.types.attrsOf (
|
||||
lib.types.submodule (service: {
|
||||
|
Loading…
Reference in New Issue
Block a user