Merge pull request #149532 from pennae/split-docs-build
nixos/*: split docs build
This commit is contained in:
commit
70d27303da
@ -177,7 +177,7 @@ rec {
|
|||||||
docOption = rec {
|
docOption = rec {
|
||||||
loc = opt.loc;
|
loc = opt.loc;
|
||||||
name = showOption opt.loc;
|
name = showOption opt.loc;
|
||||||
description = opt.description or (lib.warn "Option `${name}' has no description." "This option has no description.");
|
description = opt.description or null;
|
||||||
declarations = filter (x: x != unknownModule) opt.declarations;
|
declarations = filter (x: x != unknownModule) opt.declarations;
|
||||||
internal = opt.internal or false;
|
internal = opt.internal or false;
|
||||||
visible =
|
visible =
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
{ pkgs, options, config, version, revision, extraSources ? [] }:
|
{ pkgs
|
||||||
|
, options
|
||||||
|
, config
|
||||||
|
, version
|
||||||
|
, revision
|
||||||
|
, extraSources ? []
|
||||||
|
, baseOptionsJSON ? null
|
||||||
|
, warningsAreErrors ? true
|
||||||
|
, prefix ? ../../..
|
||||||
|
}:
|
||||||
|
|
||||||
with pkgs;
|
with pkgs;
|
||||||
|
|
||||||
@ -11,11 +20,11 @@ let
|
|||||||
#
|
#
|
||||||
# E.g. if some `options` came from modules in ${pkgs.customModules}/nix,
|
# E.g. if some `options` came from modules in ${pkgs.customModules}/nix,
|
||||||
# you'd need to include `extraSources = [ pkgs.customModules ]`
|
# you'd need to include `extraSources = [ pkgs.customModules ]`
|
||||||
prefixesToStrip = map (p: "${toString p}/") ([ ../../.. ] ++ extraSources);
|
prefixesToStrip = map (p: "${toString p}/") ([ prefix ] ++ extraSources);
|
||||||
stripAnyPrefixes = lib.flip (lib.foldr lib.removePrefix) prefixesToStrip;
|
stripAnyPrefixes = lib.flip (lib.foldr lib.removePrefix) prefixesToStrip;
|
||||||
|
|
||||||
optionsDoc = buildPackages.nixosOptionsDoc {
|
optionsDoc = buildPackages.nixosOptionsDoc {
|
||||||
inherit options revision;
|
inherit options revision baseOptionsJSON warningsAreErrors;
|
||||||
transformOptions = opt: opt // {
|
transformOptions = opt: opt // {
|
||||||
# Clean up declaration sites to not refer to the NixOS source tree.
|
# Clean up declaration sites to not refer to the NixOS source tree.
|
||||||
declarations = map stripAnyPrefixes opt.declarations;
|
declarations = map stripAnyPrefixes opt.declarations;
|
||||||
@ -161,7 +170,7 @@ let
|
|||||||
in rec {
|
in rec {
|
||||||
inherit generatedSources;
|
inherit generatedSources;
|
||||||
|
|
||||||
inherit (optionsDoc) optionsJSON optionsDocBook;
|
inherit (optionsDoc) optionsJSON optionsNix optionsDocBook;
|
||||||
|
|
||||||
# Generate the NixOS manual.
|
# Generate the NixOS manual.
|
||||||
manualHTML = runCommand "nixos-manual-html"
|
manualHTML = runCommand "nixos-manual-html"
|
||||||
|
@ -5,7 +5,7 @@ extra information. Module meta attributes are defined in the `meta.nix`
|
|||||||
special module.
|
special module.
|
||||||
|
|
||||||
`meta` is a top level attribute like `options` and `config`. Available
|
`meta` is a top level attribute like `options` and `config`. Available
|
||||||
meta-attributes are `maintainers` and `doc`.
|
meta-attributes are `maintainers`, `doc`, and `buildDocsInSandbox`.
|
||||||
|
|
||||||
Each of the meta-attributes must be defined at most once per module
|
Each of the meta-attributes must be defined at most once per module
|
||||||
file.
|
file.
|
||||||
@ -24,6 +24,7 @@ file.
|
|||||||
meta = {
|
meta = {
|
||||||
maintainers = with lib.maintainers; [ ericsagnes ];
|
maintainers = with lib.maintainers; [ ericsagnes ];
|
||||||
doc = ./default.xml;
|
doc = ./default.xml;
|
||||||
|
buildDocsInSandbox = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -38,3 +39,28 @@ file.
|
|||||||
```ShellSession
|
```ShellSession
|
||||||
$ nix-build nixos/release.nix -A manual.x86_64-linux
|
$ nix-build nixos/release.nix -A manual.x86_64-linux
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- `buildDocsInSandbox` indicates whether the option documentation for the
|
||||||
|
module can be built in a derivation sandbox. This option is currently only
|
||||||
|
honored for modules shipped by nixpkgs. User modules and modules taken from
|
||||||
|
`NIXOS_EXTRA_MODULE_PATH` are always built outside of the sandbox, as has
|
||||||
|
been the case in previous releases.
|
||||||
|
|
||||||
|
Building NixOS option documentation in a sandbox allows caching of the built
|
||||||
|
documentation, which greatly decreases the amount of time needed to evaluate
|
||||||
|
a system configuration that has NixOS documentation enabled. The sandbox also
|
||||||
|
restricts which attributes may be referenced by documentation attributes
|
||||||
|
(such as option descriptions) to the `options` and `lib` module arguments and
|
||||||
|
the `pkgs.formats` attribute of the `pkgs` argument, `config` and the rest of
|
||||||
|
`pkgs` are disallowed and will cause doc build failures when used. This
|
||||||
|
restriction is necessary because we cannot reproduce the full nixpkgs
|
||||||
|
instantiation with configuration and overlays from a system configuration
|
||||||
|
inside the sandbox. The `options` argument only includes options of modules
|
||||||
|
that are also built inside the sandbox, referencing an option of a module
|
||||||
|
that isn't built in the sandbox is also forbidden.
|
||||||
|
|
||||||
|
The default is `true` and should usually not be changed; set it to `false`
|
||||||
|
only if the module requires access to `pkgs` in its documentation (e.g.
|
||||||
|
because it loads information from a linked package to build an option type)
|
||||||
|
or if its documentation depends on other modules that also aren't sandboxed
|
||||||
|
(e.g. by using types defined in the other module).
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
<para>
|
<para>
|
||||||
<literal>meta</literal> is a top level attribute like
|
<literal>meta</literal> is a top level attribute like
|
||||||
<literal>options</literal> and <literal>config</literal>. Available
|
<literal>options</literal> and <literal>config</literal>. Available
|
||||||
meta-attributes are <literal>maintainers</literal> and
|
meta-attributes are <literal>maintainers</literal>,
|
||||||
<literal>doc</literal>.
|
<literal>doc</literal>, and <literal>buildDocsInSandbox</literal>.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Each of the meta-attributes must be defined at most once per module
|
Each of the meta-attributes must be defined at most once per module
|
||||||
@ -29,6 +29,7 @@
|
|||||||
meta = {
|
meta = {
|
||||||
maintainers = with lib.maintainers; [ ericsagnes ];
|
maintainers = with lib.maintainers; [ ericsagnes ];
|
||||||
doc = ./default.xml;
|
doc = ./default.xml;
|
||||||
|
buildDocsInSandbox = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
</programlisting>
|
</programlisting>
|
||||||
@ -51,5 +52,44 @@
|
|||||||
$ nix-build nixos/release.nix -A manual.x86_64-linux
|
$ nix-build nixos/release.nix -A manual.x86_64-linux
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
<literal>buildDocsInSandbox</literal> indicates whether the
|
||||||
|
option documentation for the module can be built in a derivation
|
||||||
|
sandbox. This option is currently only honored for modules
|
||||||
|
shipped by nixpkgs. User modules and modules taken from
|
||||||
|
<literal>NIXOS_EXTRA_MODULE_PATH</literal> are always built
|
||||||
|
outside of the sandbox, as has been the case in previous
|
||||||
|
releases.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Building NixOS option documentation in a sandbox allows caching
|
||||||
|
of the built documentation, which greatly decreases the amount
|
||||||
|
of time needed to evaluate a system configuration that has NixOS
|
||||||
|
documentation enabled. The sandbox also restricts which
|
||||||
|
attributes may be referenced by documentation attributes (such
|
||||||
|
as option descriptions) to the <literal>options</literal> and
|
||||||
|
<literal>lib</literal> module arguments and the
|
||||||
|
<literal>pkgs.formats</literal> attribute of the
|
||||||
|
<literal>pkgs</literal> argument, <literal>config</literal> and
|
||||||
|
the rest of <literal>pkgs</literal> are disallowed and will
|
||||||
|
cause doc build failures when used. This restriction is
|
||||||
|
necessary because we cannot reproduce the full nixpkgs
|
||||||
|
instantiation with configuration and overlays from a system
|
||||||
|
configuration inside the sandbox. The <literal>options</literal>
|
||||||
|
argument only includes options of modules that are also built
|
||||||
|
inside the sandbox, referencing an option of a module that isn’t
|
||||||
|
built in the sandbox is also forbidden.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
The default is <literal>true</literal> and should usually not be
|
||||||
|
changed; set it to <literal>false</literal> only if the module
|
||||||
|
requires access to <literal>pkgs</literal> in its documentation
|
||||||
|
(e.g. because it loads information from a linked package to
|
||||||
|
build an option type) or if its documentation depends on other
|
||||||
|
modules that also aren’t sandboxed (e.g. by using types defined
|
||||||
|
in the other module).
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</section>
|
</section>
|
||||||
|
53
nixos/lib/eval-cacheable-options.nix
Normal file
53
nixos/lib/eval-cacheable-options.nix
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{ libPath
|
||||||
|
, pkgsLibPath
|
||||||
|
, nixosPath
|
||||||
|
, modules
|
||||||
|
, stateVersion
|
||||||
|
, release
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
lib = import libPath;
|
||||||
|
modulesPath = "${nixosPath}/modules";
|
||||||
|
# dummy pkgs set that contains no packages, only `pkgs.lib` from the full set.
|
||||||
|
# not having `pkgs.lib` causes all users of `pkgs.formats` to fail.
|
||||||
|
pkgs = import pkgsLibPath {
|
||||||
|
inherit lib;
|
||||||
|
pkgs = null;
|
||||||
|
};
|
||||||
|
utils = import "${nixosPath}/lib/utils.nix" {
|
||||||
|
inherit config lib;
|
||||||
|
pkgs = null;
|
||||||
|
};
|
||||||
|
# this is used both as a module and as specialArgs.
|
||||||
|
# as a module it sets the _module special values, as specialArgs it makes `config`
|
||||||
|
# unusable. this causes documentation attributes depending on `config` to fail.
|
||||||
|
config = {
|
||||||
|
_module.check = false;
|
||||||
|
_module.args = {};
|
||||||
|
system.stateVersion = stateVersion;
|
||||||
|
};
|
||||||
|
eval = lib.evalModules {
|
||||||
|
modules = (map (m: "${modulesPath}/${m}") modules) ++ [
|
||||||
|
config
|
||||||
|
];
|
||||||
|
specialArgs = {
|
||||||
|
inherit config pkgs utils;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
docs = import "${nixosPath}/doc/manual" {
|
||||||
|
pkgs = pkgs // {
|
||||||
|
inherit lib;
|
||||||
|
# duplicate of the declaration in all-packages.nix
|
||||||
|
buildPackages.nixosOptionsDoc = attrs:
|
||||||
|
(import "${nixosPath}/lib/make-options-doc")
|
||||||
|
({ inherit pkgs lib; } // attrs);
|
||||||
|
};
|
||||||
|
config = config.config;
|
||||||
|
options = eval.options;
|
||||||
|
version = release;
|
||||||
|
revision = "release-${release}";
|
||||||
|
prefix = modulesPath;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
docs.optionsNix
|
@ -21,6 +21,13 @@
|
|||||||
, options
|
, options
|
||||||
, transformOptions ? lib.id # function for additional tranformations of the options
|
, transformOptions ? lib.id # function for additional tranformations of the options
|
||||||
, revision ? "" # Specify revision for the options
|
, revision ? "" # Specify revision for the options
|
||||||
|
# a set of options the docs we are generating will be merged into, as if by recursiveUpdate.
|
||||||
|
# used to split the options doc build into a static part (nixos/modules) and a dynamic part
|
||||||
|
# (non-nixos modules imported via configuration.nix, other module sources).
|
||||||
|
, baseOptionsJSON ? null
|
||||||
|
# instead of printing warnings for eg options with missing descriptions (which may be lost
|
||||||
|
# by nix build unless -L is given), emit errors instead and fail the build
|
||||||
|
, warningsAreErrors ? true
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -51,10 +58,15 @@ let
|
|||||||
# ../../../lib/options.nix influences.
|
# ../../../lib/options.nix influences.
|
||||||
#
|
#
|
||||||
# Each element of `relatedPackages` can be either
|
# Each element of `relatedPackages` can be either
|
||||||
# - a string: that will be interpreted as an attribute name from `pkgs`,
|
# - a string: that will be interpreted as an attribute name from `pkgs` and turned into a link
|
||||||
# - a list: that will be interpreted as an attribute path from `pkgs`,
|
# to search.nixos.org,
|
||||||
# - an attrset: that can specify `name`, `path`, `package`, `comment`
|
# - a list: that will be interpreted as an attribute path from `pkgs` and turned into a link
|
||||||
|
# to search.nixos.org,
|
||||||
|
# - an attrset: that can specify `name`, `path`, `comment`
|
||||||
# (either of `name`, `path` is required, the rest are optional).
|
# (either of `name`, `path` is required, the rest are optional).
|
||||||
|
#
|
||||||
|
# NOTE: No checks against `pkgs` are made to ensure that the referenced package actually exists.
|
||||||
|
# Such checks are not compatible with option docs caching.
|
||||||
genRelatedPackages = packages: optName:
|
genRelatedPackages = packages: optName:
|
||||||
let
|
let
|
||||||
unpack = p: if lib.isString p then { name = p; }
|
unpack = p: if lib.isString p then { name = p; }
|
||||||
@ -64,16 +76,16 @@ let
|
|||||||
let
|
let
|
||||||
title = args.title or null;
|
title = args.title or null;
|
||||||
name = args.name or (lib.concatStringsSep "." args.path);
|
name = args.name or (lib.concatStringsSep "." args.path);
|
||||||
path = args.path or [ args.name ];
|
in ''
|
||||||
package = args.package or (lib.attrByPath path (throw "Invalid package attribute path `${toString path}' found while evaluating `relatedPackages' of option `${optName}'") pkgs);
|
<listitem>
|
||||||
in "<listitem>"
|
<para>
|
||||||
+ "<para><literal>${lib.optionalString (title != null) "${title} aka "}pkgs.${name} (${package.meta.name})</literal>"
|
<link xlink:href="https://search.nixos.org/packages?show=${name}&sort=relevance&query=${name}">
|
||||||
+ lib.optionalString (!package.meta.available) " <emphasis>[UNAVAILABLE]</emphasis>"
|
<literal>${lib.optionalString (title != null) "${title} aka "}pkgs.${name}</literal>
|
||||||
+ ": ${package.meta.description or "???"}.</para>"
|
</link>
|
||||||
+ lib.optionalString (args ? comment) "\n<para>${args.comment}</para>"
|
</para>
|
||||||
# Lots of `longDescription's break DocBook, so we just wrap them into <programlisting>
|
${lib.optionalString (args ? comment) "<para>${args.comment}</para>"}
|
||||||
+ lib.optionalString (package.meta ? longDescription) "\n<programlisting>${package.meta.longDescription}</programlisting>"
|
</listitem>
|
||||||
+ "</listitem>";
|
'';
|
||||||
in "<itemizedlist>${lib.concatStringsSep "\n" (map (p: describe (unpack p)) packages)}</itemizedlist>";
|
in "<itemizedlist>${lib.concatStringsSep "\n" (map (p: describe (unpack p)) packages)}</itemizedlist>";
|
||||||
|
|
||||||
# Remove invisible and internal options.
|
# Remove invisible and internal options.
|
||||||
@ -99,13 +111,24 @@ in rec {
|
|||||||
optionsJSON = pkgs.runCommand "options.json"
|
optionsJSON = pkgs.runCommand "options.json"
|
||||||
{ meta.description = "List of NixOS options in JSON format";
|
{ meta.description = "List of NixOS options in JSON format";
|
||||||
buildInputs = [ pkgs.brotli ];
|
buildInputs = [ pkgs.brotli ];
|
||||||
|
options = builtins.toFile "options.json"
|
||||||
|
(builtins.unsafeDiscardStringContext (builtins.toJSON optionsNix));
|
||||||
}
|
}
|
||||||
''
|
''
|
||||||
# Export list of options in different format.
|
# Export list of options in different format.
|
||||||
dst=$out/share/doc/nixos
|
dst=$out/share/doc/nixos
|
||||||
mkdir -p $dst
|
mkdir -p $dst
|
||||||
|
|
||||||
cp ${builtins.toFile "options.json" (builtins.unsafeDiscardStringContext (builtins.toJSON optionsNix))} $dst/options.json
|
${
|
||||||
|
if baseOptionsJSON == null
|
||||||
|
then "cp $options $dst/options.json"
|
||||||
|
else ''
|
||||||
|
${pkgs.python3Minimal}/bin/python ${./mergeJSON.py} \
|
||||||
|
${lib.optionalString warningsAreErrors "--warnings-are-errors"} \
|
||||||
|
${baseOptionsJSON} $options \
|
||||||
|
> $dst/options.json
|
||||||
|
''
|
||||||
|
}
|
||||||
|
|
||||||
brotli -9 < $dst/options.json > $dst/options.json.br
|
brotli -9 < $dst/options.json > $dst/options.json.br
|
||||||
|
|
||||||
|
86
nixos/lib/make-options-doc/mergeJSON.py
Normal file
86
nixos/lib/make-options-doc/mergeJSON.py
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
import collections
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
|
JSON = Dict[str, Any]
|
||||||
|
|
||||||
|
class Key:
|
||||||
|
def __init__(self, path: List[str]):
|
||||||
|
self.path = path
|
||||||
|
def __hash__(self):
|
||||||
|
result = 0
|
||||||
|
for id in self.path:
|
||||||
|
result ^= hash(id)
|
||||||
|
return result
|
||||||
|
def __eq__(self, other):
|
||||||
|
return type(self) is type(other) and self.path == other.path
|
||||||
|
|
||||||
|
Option = collections.namedtuple('Option', ['name', 'value'])
|
||||||
|
|
||||||
|
# pivot a dict of options keyed by their display name to a dict keyed by their path
|
||||||
|
def pivot(options: Dict[str, JSON]) -> Dict[Key, Option]:
|
||||||
|
result: Dict[Key, Option] = dict()
|
||||||
|
for (name, opt) in options.items():
|
||||||
|
result[Key(opt['loc'])] = Option(name, opt)
|
||||||
|
return result
|
||||||
|
|
||||||
|
# pivot back to indexed-by-full-name
|
||||||
|
# like the docbook build we'll just fail if multiple options with differing locs
|
||||||
|
# render to the same option name.
|
||||||
|
def unpivot(options: Dict[Key, Option]) -> Dict[str, JSON]:
|
||||||
|
result: Dict[str, Dict] = dict()
|
||||||
|
for (key, opt) in options.items():
|
||||||
|
if opt.name in result:
|
||||||
|
raise RuntimeError(
|
||||||
|
'multiple options with colliding ids found',
|
||||||
|
opt.name,
|
||||||
|
result[opt.name]['loc'],
|
||||||
|
opt.value['loc'],
|
||||||
|
)
|
||||||
|
result[opt.name] = opt.value
|
||||||
|
return result
|
||||||
|
|
||||||
|
warningsAreErrors = sys.argv[1] == "--warnings-are-errors"
|
||||||
|
optOffset = 1 if warningsAreErrors else 0
|
||||||
|
options = pivot(json.load(open(sys.argv[1 + optOffset], 'r')))
|
||||||
|
overrides = pivot(json.load(open(sys.argv[2 + optOffset], 'r')))
|
||||||
|
|
||||||
|
# fix up declaration paths in lazy options, since we don't eval them from a full nixpkgs dir
|
||||||
|
for (k, v) in options.items():
|
||||||
|
v.value['declarations'] = list(map(lambda s: f'nixos/modules/{s}', v.value['declarations']))
|
||||||
|
|
||||||
|
# merge both descriptions
|
||||||
|
for (k, v) in overrides.items():
|
||||||
|
cur = options.setdefault(k, v).value
|
||||||
|
for (ok, ov) in v.value.items():
|
||||||
|
if ok == 'declarations':
|
||||||
|
decls = cur[ok]
|
||||||
|
for d in ov:
|
||||||
|
if d not in decls:
|
||||||
|
decls += [d]
|
||||||
|
elif ok == "type":
|
||||||
|
# ignore types of placeholder options
|
||||||
|
if ov != "_unspecified" or cur[ok] == "_unspecified":
|
||||||
|
cur[ok] = ov
|
||||||
|
elif ov is not None or cur.get(ok, None) is None:
|
||||||
|
cur[ok] = ov
|
||||||
|
|
||||||
|
# check that every option has a description
|
||||||
|
hasWarnings = False
|
||||||
|
for (k, v) in options.items():
|
||||||
|
if v.value.get('description', None) is None:
|
||||||
|
severity = "error" if warningsAreErrors else "warning"
|
||||||
|
hasWarnings = True
|
||||||
|
print(f"\x1b[1;31m{severity}: option {v.name} has no description\x1b[0m", file=sys.stderr)
|
||||||
|
v.value['description'] = "This option has no description."
|
||||||
|
if hasWarnings and warningsAreErrors:
|
||||||
|
print(
|
||||||
|
"\x1b[1;31m" +
|
||||||
|
"Treating warnings as errors. Set documentation.nixos.options.warningsAreErrors " +
|
||||||
|
"to false to ignore these warnings." +
|
||||||
|
"\x1b[0m",
|
||||||
|
file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
json.dump(unpivot(options), fp=sys.stdout)
|
@ -40,4 +40,7 @@ in
|
|||||||
};
|
};
|
||||||
services.xserver.displayManager.sessionCommands = "${fcitxPackage}/bin/fcitx";
|
services.xserver.displayManager.sessionCommands = "${fcitxPackage}/bin/fcitx";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# uses attributes of the linked package
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -80,4 +80,7 @@ in
|
|||||||
ibusPackage
|
ibusPackage
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# uses attributes of the linked package
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -45,5 +45,7 @@ in
|
|||||||
|
|
||||||
environment.etc."xdg/kime/config.yaml".text = replaceStrings [ "\\\\" ] [ "\\" ] (builtins.toJSON cfg.config);
|
environment.etc."xdg/kime/config.yaml".text = replaceStrings [ "\\\\" ] [ "\\" ] (builtins.toJSON cfg.config);
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
# uses attributes of the linked package
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
|
}
|
||||||
|
@ -1,19 +1,35 @@
|
|||||||
{ config, lib, pkgs, extendModules, noUserModules, ... }:
|
{ config, options, lib, pkgs, utils, modules, baseModules, extraModules, modulesPath, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.documentation;
|
cfg = config.documentation;
|
||||||
|
allOpts = options;
|
||||||
|
|
||||||
/* Modules for which to show options even when not imported. */
|
/* Modules for which to show options even when not imported. */
|
||||||
extraDocModules = [ ../virtualisation/qemu-vm.nix ];
|
extraDocModules = [ ../virtualisation/qemu-vm.nix ];
|
||||||
|
|
||||||
/* For the purpose of generating docs, evaluate options with each derivation
|
canCacheDocs = m:
|
||||||
in `pkgs` (recursively) replaced by a fake with path "\${pkgs.attribute.path}".
|
let
|
||||||
It isn't perfect, but it seems to cover a vast majority of use cases.
|
f = import m;
|
||||||
Caveat: even if the package is reached by a different means,
|
instance = f (mapAttrs (n: _: abort "evaluating ${n} for `meta` failed") (functionArgs f));
|
||||||
the path above will be shown and not e.g. `${config.services.foo.package}`. */
|
in
|
||||||
|
cfg.nixos.options.splitBuild
|
||||||
|
&& builtins.isPath m
|
||||||
|
&& isFunction f
|
||||||
|
&& instance ? options
|
||||||
|
&& instance.meta.buildDocsInSandbox or true;
|
||||||
|
|
||||||
|
docModules =
|
||||||
|
let
|
||||||
|
p = partition canCacheDocs (baseModules ++ extraDocModules);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
lazy = p.right;
|
||||||
|
eager = p.wrong ++ optionals cfg.nixos.includeAllModules (extraModules ++ modules);
|
||||||
|
};
|
||||||
|
|
||||||
manual = import ../../doc/manual rec {
|
manual = import ../../doc/manual rec {
|
||||||
inherit pkgs config;
|
inherit pkgs config;
|
||||||
version = config.system.nixos.release;
|
version = config.system.nixos.release;
|
||||||
@ -21,10 +37,17 @@ let
|
|||||||
extraSources = cfg.nixos.extraModuleSources;
|
extraSources = cfg.nixos.extraModuleSources;
|
||||||
options =
|
options =
|
||||||
let
|
let
|
||||||
extendNixOS = if cfg.nixos.includeAllModules then extendModules else noUserModules.extendModules;
|
scrubbedEval = evalModules {
|
||||||
scrubbedEval = extendNixOS {
|
modules = [ {
|
||||||
modules = extraDocModules;
|
_module.check = false;
|
||||||
specialArgs.pkgs = scrubDerivations "pkgs" pkgs;
|
} ] ++ docModules.eager;
|
||||||
|
specialArgs = {
|
||||||
|
pkgs = scrubDerivations "pkgs" pkgs;
|
||||||
|
# allow access to arbitrary options for eager modules, eg for getting
|
||||||
|
# option types from lazy modules
|
||||||
|
options = allOpts;
|
||||||
|
inherit modulesPath utils;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
scrubDerivations = namePrefix: pkgSet: mapAttrs
|
scrubDerivations = namePrefix: pkgSet: mapAttrs
|
||||||
(name: value:
|
(name: value:
|
||||||
@ -36,6 +59,53 @@ let
|
|||||||
)
|
)
|
||||||
pkgSet;
|
pkgSet;
|
||||||
in scrubbedEval.options;
|
in scrubbedEval.options;
|
||||||
|
baseOptionsJSON =
|
||||||
|
let
|
||||||
|
filter =
|
||||||
|
builtins.filterSource
|
||||||
|
(n: t:
|
||||||
|
(t == "directory" -> baseNameOf n != "tests")
|
||||||
|
&& (t == "file" -> hasSuffix ".nix" n)
|
||||||
|
);
|
||||||
|
pull = dir:
|
||||||
|
if isStorePath pkgs.path
|
||||||
|
then "${builtins.storePath pkgs.path}/${dir}"
|
||||||
|
else filter "${toString pkgs.path}/${dir}";
|
||||||
|
in
|
||||||
|
pkgs.runCommand "lazy-options.json" {
|
||||||
|
libPath = pull "lib";
|
||||||
|
pkgsLibPath = pull "pkgs/pkgs-lib";
|
||||||
|
nixosPath = pull "nixos";
|
||||||
|
modules = map (p: ''"${removePrefix "${modulesPath}/" (toString p)}"'') docModules.lazy;
|
||||||
|
} ''
|
||||||
|
export NIX_STORE_DIR=$TMPDIR/store
|
||||||
|
export NIX_STATE_DIR=$TMPDIR/state
|
||||||
|
${pkgs.nix}/bin/nix-instantiate \
|
||||||
|
--show-trace \
|
||||||
|
--eval --json --strict \
|
||||||
|
--argstr libPath "$libPath" \
|
||||||
|
--argstr pkgsLibPath "$pkgsLibPath" \
|
||||||
|
--argstr nixosPath "$nixosPath" \
|
||||||
|
--arg modules "[ $modules ]" \
|
||||||
|
--argstr stateVersion "${options.system.stateVersion.default}" \
|
||||||
|
--argstr release "${config.system.nixos.release}" \
|
||||||
|
$nixosPath/lib/eval-cacheable-options.nix > $out \
|
||||||
|
|| {
|
||||||
|
echo -en "\e[1;31m"
|
||||||
|
echo 'Cacheable portion of option doc build failed.'
|
||||||
|
echo 'Usually this means that an option attribute that ends up in documentation (eg' \
|
||||||
|
'`default` or `description`) depends on the restricted module arguments' \
|
||||||
|
'`config` or `pkgs`.'
|
||||||
|
echo
|
||||||
|
echo 'Rebuild your configuration with `--show-trace` to find the offending' \
|
||||||
|
'location. Remove the references to restricted arguments (eg by escaping' \
|
||||||
|
'their antiquotations or adding a `defaultText`) or disable the sandboxed' \
|
||||||
|
'build for the failing module by setting `meta.buildDocsInSandbox = false`.'
|
||||||
|
echo -en "\e[0m"
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
'';
|
||||||
|
inherit (cfg.nixos.options) warningsAreErrors;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -178,6 +248,25 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nixos.options.splitBuild = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Whether to split the option docs build into a cacheable and an uncacheable part.
|
||||||
|
Splitting the build can substantially decrease the amount of time needed to build
|
||||||
|
the manual, but some user modules may be incompatible with this splitting.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
nixos.options.warningsAreErrors = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Treat warning emitted during the option documentation build (eg for missing option
|
||||||
|
descriptions) as errors.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
nixos.includeAllModules = mkOption {
|
nixos.includeAllModules = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -54,6 +54,21 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
buildDocsInSandbox = mkOption {
|
||||||
|
type = types.bool // {
|
||||||
|
merge = loc: defs: defs;
|
||||||
|
};
|
||||||
|
internal = true;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Whether to include this module in the split options doc build.
|
||||||
|
Disable if the module references `config`, `pkgs` or other module
|
||||||
|
arguments that cannot be evaluated as constants.
|
||||||
|
|
||||||
|
This option should be defined at most once per module.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -248,4 +248,7 @@ in
|
|||||||
)
|
)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# needs a full nixpkgs path to import nixpkgs
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -119,4 +119,6 @@ in
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# uses version info nixpkgs, which requires a full nixpkgs path
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -149,4 +149,6 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# uses attributes of the linked package
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,10 @@ let
|
|||||||
datasetOptions = rec {
|
datasetOptions = rec {
|
||||||
use_template = mkOption {
|
use_template = mkOption {
|
||||||
description = "Names of the templates to use for this dataset.";
|
description = "Names of the templates to use for this dataset.";
|
||||||
type = types.listOf (types.enum (attrNames cfg.templates));
|
type = types.listOf (types.str // {
|
||||||
|
check = (types.enum (attrNames cfg.templates)).check;
|
||||||
|
description = "configured template name";
|
||||||
|
});
|
||||||
default = [ ];
|
default = [ ];
|
||||||
};
|
};
|
||||||
useTemplate = use_template;
|
useTemplate = use_template;
|
||||||
|
@ -6,6 +6,7 @@ let
|
|||||||
top = config.services.kubernetes;
|
top = config.services.kubernetes;
|
||||||
otop = options.services.kubernetes;
|
otop = options.services.kubernetes;
|
||||||
cfg = top.controllerManager;
|
cfg = top.controllerManager;
|
||||||
|
klib = options.services.kubernetes.lib.default;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
@ -56,7 +57,7 @@ in
|
|||||||
type = int;
|
type = int;
|
||||||
};
|
};
|
||||||
|
|
||||||
kubeconfig = top.lib.mkKubeConfigOptions "Kubernetes controller manager";
|
kubeconfig = klib.mkKubeConfigOptions "Kubernetes controller manager";
|
||||||
|
|
||||||
leaderElect = mkOption {
|
leaderElect = mkOption {
|
||||||
description = "Whether to start leader election before executing main loop.";
|
description = "Whether to start leader election before executing main loop.";
|
||||||
@ -129,7 +130,7 @@ in
|
|||||||
"--cluster-cidr=${cfg.clusterCidr}"} \
|
"--cluster-cidr=${cfg.clusterCidr}"} \
|
||||||
${optionalString (cfg.featureGates != [])
|
${optionalString (cfg.featureGates != [])
|
||||||
"--feature-gates=${concatMapStringsSep "," (feature: "${feature}=true") cfg.featureGates}"} \
|
"--feature-gates=${concatMapStringsSep "," (feature: "${feature}=true") cfg.featureGates}"} \
|
||||||
--kubeconfig=${top.lib.mkKubeConfig "kube-controller-manager" cfg.kubeconfig} \
|
--kubeconfig=${klib.mkKubeConfig "kube-controller-manager" cfg.kubeconfig} \
|
||||||
--leader-elect=${boolToString cfg.leaderElect} \
|
--leader-elect=${boolToString cfg.leaderElect} \
|
||||||
${optionalString (cfg.rootCaFile!=null)
|
${optionalString (cfg.rootCaFile!=null)
|
||||||
"--root-ca-file=${cfg.rootCaFile}"} \
|
"--root-ca-file=${cfg.rootCaFile}"} \
|
||||||
@ -156,7 +157,7 @@ in
|
|||||||
path = top.path;
|
path = top.path;
|
||||||
};
|
};
|
||||||
|
|
||||||
services.kubernetes.pki.certs = with top.lib; {
|
services.kubernetes.pki.certs = with klib; {
|
||||||
controllerManager = mkCert {
|
controllerManager = mkCert {
|
||||||
name = "kube-controller-manager";
|
name = "kube-controller-manager";
|
||||||
CN = "kube-controller-manager";
|
CN = "kube-controller-manager";
|
||||||
|
@ -193,12 +193,17 @@ in {
|
|||||||
inherit mkKubeConfigOptions;
|
inherit mkKubeConfigOptions;
|
||||||
};
|
};
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
|
readOnly = true;
|
||||||
|
internal = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
secretsPath = mkOption {
|
secretsPath = mkOption {
|
||||||
description = "Default location for kubernetes secrets. Not a store location.";
|
description = "Default location for kubernetes secrets. Not a store location.";
|
||||||
type = types.path;
|
type = types.path;
|
||||||
default = cfg.dataDir + "/secrets";
|
default = cfg.dataDir + "/secrets";
|
||||||
|
defaultText = literalExpression ''
|
||||||
|
config.${opt.dataDir} + "/secrets"
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ let
|
|||||||
top = config.services.kubernetes;
|
top = config.services.kubernetes;
|
||||||
otop = options.services.kubernetes;
|
otop = options.services.kubernetes;
|
||||||
cfg = top.kubelet;
|
cfg = top.kubelet;
|
||||||
|
klib = options.services.kubernetes.lib.default;
|
||||||
|
|
||||||
cniConfig =
|
cniConfig =
|
||||||
if cfg.cni.config != [] && cfg.cni.configDir != null then
|
if cfg.cni.config != [] && cfg.cni.configDir != null then
|
||||||
@ -27,7 +28,7 @@ let
|
|||||||
config.Cmd = ["/bin/pause"];
|
config.Cmd = ["/bin/pause"];
|
||||||
};
|
};
|
||||||
|
|
||||||
kubeconfig = top.lib.mkKubeConfig "kubelet" cfg.kubeconfig;
|
kubeconfig = klib.mkKubeConfig "kubelet" cfg.kubeconfig;
|
||||||
|
|
||||||
manifestPath = "kubernetes/manifests";
|
manifestPath = "kubernetes/manifests";
|
||||||
|
|
||||||
@ -177,7 +178,7 @@ in
|
|||||||
type = str;
|
type = str;
|
||||||
};
|
};
|
||||||
|
|
||||||
kubeconfig = top.lib.mkKubeConfigOptions "Kubelet";
|
kubeconfig = klib.mkKubeConfigOptions "Kubelet";
|
||||||
|
|
||||||
manifests = mkOption {
|
manifests = mkOption {
|
||||||
description = "List of manifests to bootstrap with kubelet (only pods can be created as manifest entry)";
|
description = "List of manifests to bootstrap with kubelet (only pods can be created as manifest entry)";
|
||||||
@ -358,7 +359,7 @@ in
|
|||||||
services.kubernetes.kubelet.hostname = with config.networking;
|
services.kubernetes.kubelet.hostname = with config.networking;
|
||||||
mkDefault (hostName + optionalString (domain != null) ".${domain}");
|
mkDefault (hostName + optionalString (domain != null) ".${domain}");
|
||||||
|
|
||||||
services.kubernetes.pki.certs = with top.lib; {
|
services.kubernetes.pki.certs = with klib; {
|
||||||
kubelet = mkCert {
|
kubelet = mkCert {
|
||||||
name = "kubelet";
|
name = "kubelet";
|
||||||
CN = top.kubelet.hostname;
|
CN = top.kubelet.hostname;
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, options, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
top = config.services.kubernetes;
|
top = config.services.kubernetes;
|
||||||
cfg = top.pki;
|
cfg = top.pki;
|
||||||
|
klib = options.services.kubernetes.lib;
|
||||||
|
|
||||||
csrCA = pkgs.writeText "kube-pki-cacert-csr.json" (builtins.toJSON {
|
csrCA = pkgs.writeText "kube-pki-cacert-csr.json" (builtins.toJSON {
|
||||||
key = {
|
key = {
|
||||||
@ -29,7 +30,7 @@ let
|
|||||||
cfsslAPITokenLength = 32;
|
cfsslAPITokenLength = 32;
|
||||||
|
|
||||||
clusterAdminKubeconfig = with cfg.certs.clusterAdmin;
|
clusterAdminKubeconfig = with cfg.certs.clusterAdmin;
|
||||||
top.lib.mkKubeConfig "cluster-admin" {
|
klib.mkKubeConfig "cluster-admin" {
|
||||||
server = top.apiserverAddress;
|
server = top.apiserverAddress;
|
||||||
certFile = cert;
|
certFile = cert;
|
||||||
keyFile = key;
|
keyFile = key;
|
||||||
@ -250,7 +251,7 @@ in
|
|||||||
# - it would be better with a more Nix-oriented way of managing addons
|
# - it would be better with a more Nix-oriented way of managing addons
|
||||||
systemd.services.kube-addon-manager = mkIf top.addonManager.enable (mkMerge [{
|
systemd.services.kube-addon-manager = mkIf top.addonManager.enable (mkMerge [{
|
||||||
environment.KUBECONFIG = with cfg.certs.addonManager;
|
environment.KUBECONFIG = with cfg.certs.addonManager;
|
||||||
top.lib.mkKubeConfig "addon-manager" {
|
klib.mkKubeConfig "addon-manager" {
|
||||||
server = top.apiserverAddress;
|
server = top.apiserverAddress;
|
||||||
certFile = cert;
|
certFile = cert;
|
||||||
keyFile = key;
|
keyFile = key;
|
||||||
@ -343,7 +344,7 @@ in
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
services.flannel = with cfg.certs.flannelClient; {
|
services.flannel = with cfg.certs.flannelClient; {
|
||||||
kubeconfig = top.lib.mkKubeConfig "flannel" {
|
kubeconfig = klib.mkKubeConfig "flannel" {
|
||||||
server = top.apiserverAddress;
|
server = top.apiserverAddress;
|
||||||
certFile = cert;
|
certFile = cert;
|
||||||
keyFile = key;
|
keyFile = key;
|
||||||
|
@ -6,6 +6,7 @@ let
|
|||||||
top = config.services.kubernetes;
|
top = config.services.kubernetes;
|
||||||
otop = options.services.kubernetes;
|
otop = options.services.kubernetes;
|
||||||
cfg = top.proxy;
|
cfg = top.proxy;
|
||||||
|
klib = options.services.kubernetes.lib.default;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
@ -43,7 +44,7 @@ in
|
|||||||
type = str;
|
type = str;
|
||||||
};
|
};
|
||||||
|
|
||||||
kubeconfig = top.lib.mkKubeConfigOptions "Kubernetes proxy";
|
kubeconfig = klib.mkKubeConfigOptions "Kubernetes proxy";
|
||||||
|
|
||||||
verbosity = mkOption {
|
verbosity = mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
@ -72,7 +73,7 @@ in
|
|||||||
${optionalString (cfg.featureGates != [])
|
${optionalString (cfg.featureGates != [])
|
||||||
"--feature-gates=${concatMapStringsSep "," (feature: "${feature}=true") cfg.featureGates}"} \
|
"--feature-gates=${concatMapStringsSep "," (feature: "${feature}=true") cfg.featureGates}"} \
|
||||||
--hostname-override=${cfg.hostname} \
|
--hostname-override=${cfg.hostname} \
|
||||||
--kubeconfig=${top.lib.mkKubeConfig "kube-proxy" cfg.kubeconfig} \
|
--kubeconfig=${klib.mkKubeConfig "kube-proxy" cfg.kubeconfig} \
|
||||||
${optionalString (cfg.verbosity != null) "--v=${toString cfg.verbosity}"} \
|
${optionalString (cfg.verbosity != null) "--v=${toString cfg.verbosity}"} \
|
||||||
${cfg.extraOpts}
|
${cfg.extraOpts}
|
||||||
'';
|
'';
|
||||||
@ -88,7 +89,7 @@ in
|
|||||||
services.kubernetes.proxy.hostname = with config.networking; mkDefault hostName;
|
services.kubernetes.proxy.hostname = with config.networking; mkDefault hostName;
|
||||||
|
|
||||||
services.kubernetes.pki.certs = {
|
services.kubernetes.pki.certs = {
|
||||||
kubeProxyClient = top.lib.mkCert {
|
kubeProxyClient = klib.mkCert {
|
||||||
name = "kube-proxy-client";
|
name = "kube-proxy-client";
|
||||||
CN = "system:kube-proxy";
|
CN = "system:kube-proxy";
|
||||||
action = "systemctl restart kube-proxy.service";
|
action = "systemctl restart kube-proxy.service";
|
||||||
|
@ -6,6 +6,7 @@ let
|
|||||||
top = config.services.kubernetes;
|
top = config.services.kubernetes;
|
||||||
otop = options.services.kubernetes;
|
otop = options.services.kubernetes;
|
||||||
cfg = top.scheduler;
|
cfg = top.scheduler;
|
||||||
|
klib = options.services.kubernetes.lib.default;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
###### interface
|
###### interface
|
||||||
@ -32,7 +33,7 @@ in
|
|||||||
type = listOf str;
|
type = listOf str;
|
||||||
};
|
};
|
||||||
|
|
||||||
kubeconfig = top.lib.mkKubeConfigOptions "Kubernetes scheduler";
|
kubeconfig = klib.mkKubeConfigOptions "Kubernetes scheduler";
|
||||||
|
|
||||||
leaderElect = mkOption {
|
leaderElect = mkOption {
|
||||||
description = "Whether to start leader election before executing main loop.";
|
description = "Whether to start leader election before executing main loop.";
|
||||||
@ -69,7 +70,7 @@ in
|
|||||||
--address=${cfg.address} \
|
--address=${cfg.address} \
|
||||||
${optionalString (cfg.featureGates != [])
|
${optionalString (cfg.featureGates != [])
|
||||||
"--feature-gates=${concatMapStringsSep "," (feature: "${feature}=true") cfg.featureGates}"} \
|
"--feature-gates=${concatMapStringsSep "," (feature: "${feature}=true") cfg.featureGates}"} \
|
||||||
--kubeconfig=${top.lib.mkKubeConfig "kube-scheduler" cfg.kubeconfig} \
|
--kubeconfig=${klib.mkKubeConfig "kube-scheduler" cfg.kubeconfig} \
|
||||||
--leader-elect=${boolToString cfg.leaderElect} \
|
--leader-elect=${boolToString cfg.leaderElect} \
|
||||||
--port=${toString cfg.port} \
|
--port=${toString cfg.port} \
|
||||||
${optionalString (cfg.verbosity != null) "--v=${toString cfg.verbosity}"} \
|
${optionalString (cfg.verbosity != null) "--v=${toString cfg.verbosity}"} \
|
||||||
@ -87,7 +88,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
services.kubernetes.pki.certs = {
|
services.kubernetes.pki.certs = {
|
||||||
schedulerClient = top.lib.mkCert {
|
schedulerClient = klib.mkCert {
|
||||||
name = "kube-scheduler-client";
|
name = "kube-scheduler-client";
|
||||||
CN = "system:kube-scheduler";
|
CN = "system:kube-scheduler";
|
||||||
action = "systemctl restart kube-scheduler.service";
|
action = "systemctl restart kube-scheduler.service";
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, options, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.couchdb;
|
cfg = config.services.couchdb;
|
||||||
|
opt = options.services.couchdb;
|
||||||
configFile = pkgs.writeText "couchdb.ini" (
|
configFile = pkgs.writeText "couchdb.ini" (
|
||||||
''
|
''
|
||||||
[couchdb]
|
[couchdb]
|
||||||
@ -153,6 +154,7 @@ in {
|
|||||||
argsFile = mkOption {
|
argsFile = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
default = "${cfg.package}/etc/vm.args";
|
default = "${cfg.package}/etc/vm.args";
|
||||||
|
defaultText = literalExpression ''"config.${opt.package}/etc/vm.args"'';
|
||||||
description = ''
|
description = ''
|
||||||
vm.args configuration. Overrides Couchdb's Erlang VM parameters file.
|
vm.args configuration. Overrides Couchdb's Erlang VM parameters file.
|
||||||
'';
|
'';
|
||||||
|
@ -29,6 +29,8 @@ in {
|
|||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
maintainers = teams.freedesktop.members;
|
maintainers = teams.freedesktop.members;
|
||||||
|
# uses attributes of the linked package
|
||||||
|
buildDocsInSandbox = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
###### interface
|
###### interface
|
||||||
|
@ -40,6 +40,8 @@ in {
|
|||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
maintainers = teams.freedesktop.members;
|
maintainers = teams.freedesktop.members;
|
||||||
|
# uses attributes of the linked package
|
||||||
|
buildDocsInSandbox = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
###### interface
|
###### interface
|
||||||
|
@ -226,4 +226,7 @@ in {
|
|||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# uses attributes of the linked package
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -678,7 +678,7 @@ in
|
|||||||
rev = "ff96a0fa5635770390b184ae74debea75c3fd534";
|
rev = "ff96a0fa5635770390b184ae74debea75c3fd534";
|
||||||
ref = "nixos-unstable";
|
ref = "nixos-unstable";
|
||||||
};
|
};
|
||||||
image_from_nixpkgs = (import ("${pkgs.sourcehut.buildsrht}/lib/images/nixos/image.nix") {
|
image_from_nixpkgs = (import ("''${pkgs.sourcehut.buildsrht}/lib/images/nixos/image.nix") {
|
||||||
pkgs = (import pkgs_unstable {});
|
pkgs = (import pkgs_unstable {});
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
@ -696,6 +696,7 @@ in
|
|||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.git;
|
default = pkgs.git;
|
||||||
|
defaultText = literalExpression "pkgs.git";
|
||||||
example = literalExpression "pkgs.gitFull";
|
example = literalExpression "pkgs.gitFull";
|
||||||
description = ''
|
description = ''
|
||||||
Git package for git.sr.ht. This can help silence collisions.
|
Git package for git.sr.ht. This can help silence collisions.
|
||||||
@ -712,6 +713,7 @@ in
|
|||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = pkgs.mercurial;
|
default = pkgs.mercurial;
|
||||||
|
defaultText = literalExpression "pkgs.mercurial";
|
||||||
description = ''
|
description = ''
|
||||||
Mercurial package for hg.sr.ht. This can help silence collisions.
|
Mercurial package for hg.sr.ht. This can help silence collisions.
|
||||||
'';
|
'';
|
||||||
|
@ -118,4 +118,7 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# uses attributes of the linked package
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -378,4 +378,6 @@ in
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
meta.maintainers = with maintainers; [ hexa ];
|
meta.maintainers = with maintainers; [ hexa ];
|
||||||
|
# uses attributes of the linked package
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -228,5 +228,4 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
meta.maintainers = with maintainers; [ rnhmjoj ];
|
meta.maintainers = with maintainers; [ rnhmjoj ];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,7 @@ in
|
|||||||
confDir = mkOption {
|
confDir = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
default = confDir;
|
default = confDir;
|
||||||
|
defaultText = literalDocBook "generated from configuration";
|
||||||
description = "The location of the config files for xrdp.";
|
description = "The location of the config files for xrdp.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{ config, options, pkgs, lib, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.services.aesmd;
|
cfg = config.services.aesmd;
|
||||||
|
opt = options.services.aesmd;
|
||||||
|
|
||||||
sgx-psw = pkgs.sgx-psw.override { inherit (cfg) debug; };
|
sgx-psw = pkgs.sgx-psw.override { inherit (cfg) debug; };
|
||||||
|
|
||||||
@ -43,6 +44,9 @@ in
|
|||||||
options.proxyType = mkOption {
|
options.proxyType = mkOption {
|
||||||
type = with types; nullOr (enum [ "default" "direct" "manual" ]);
|
type = with types; nullOr (enum [ "default" "direct" "manual" ]);
|
||||||
default = if (cfg.settings.proxy != null) then "manual" else null;
|
default = if (cfg.settings.proxy != null) then "manual" else null;
|
||||||
|
defaultText = literalExpression ''
|
||||||
|
if (config.${opt.settings}.proxy != null) then "manual" else null
|
||||||
|
'';
|
||||||
example = "default";
|
example = "default";
|
||||||
description = ''
|
description = ''
|
||||||
Type of proxy to use. The <literal>default</literal> uses the system's default proxy.
|
Type of proxy to use. The <literal>default</literal> uses the system's default proxy.
|
||||||
|
@ -179,4 +179,7 @@ in {
|
|||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# uses attributes of the linked package
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -112,4 +112,7 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# uses attributes of the linked package
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -237,4 +237,6 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
meta.maintainers = with lib.maintainers; [ edef zimbatm ];
|
meta.maintainers = with lib.maintainers; [ edef zimbatm ];
|
||||||
|
# uses attributes of the linked package
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -167,4 +167,7 @@ in
|
|||||||
"d ${cfg.dataDir}/async/ 0750 ${user} ${group} - -"
|
"d ${cfg.dataDir}/async/ 0750 ${user} ${group} - -"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# uses attributes of the linked package
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -146,4 +146,7 @@ in
|
|||||||
group = "powerdnsadmin";
|
group = "powerdnsadmin";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# uses attributes of the linked package
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -865,4 +865,6 @@ in
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# uses relatedPackages
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -317,4 +317,6 @@ in
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# uses extendModules to generate a type
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -999,4 +999,7 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# uses types of services/x11/xserver.nix
|
||||||
|
meta.buildDocsInSandbox = false;
|
||||||
}
|
}
|
||||||
|
@ -450,5 +450,4 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user