Merge master into staging-next
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
pushd "$DIR"
|
||||
|
||||
link_manpages_filter=$(nix-build --no-out-link "$DIR/../../../doc/build-aux/pandoc-filters/link-manpages.nix")
|
||||
|
||||
# NOTE: Keep in sync with Nixpkgs manual (/doc/Makefile).
|
||||
# TODO: Remove raw-attribute when we can get rid of DocBook altogether.
|
||||
pandoc_commonmark_enabled_extensions=+attributes+fenced_divs+footnotes+bracketed_spans+definition_lists+pipe_tables+raw_attribute
|
||||
@@ -17,7 +19,7 @@ pandoc_flags=(
|
||||
# - media extraction (was only required for diagram generator)
|
||||
# - docbook-reader/citerefentry-to-rst-role.lua (only relevant for DocBook → MarkDown/rST/MyST)
|
||||
"--lua-filter=$DIR/../../../doc/build-aux/pandoc-filters/myst-reader/roles.lua"
|
||||
"--lua-filter=$DIR/../../../doc/build-aux/pandoc-filters/link-unix-man-references.lua"
|
||||
"--lua-filter=$link_manpages_filter"
|
||||
"--lua-filter=$DIR/../../../doc/build-aux/pandoc-filters/docbook-writer/rst-roles.lua"
|
||||
"--lua-filter=$DIR/../../../doc/build-aux/pandoc-filters/docbook-writer/html-elements.lua"
|
||||
"--lua-filter=$DIR/../../../doc/build-aux/pandoc-filters/docbook-writer/labelless-link-is-xref.lua"
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
# characteristics but (hopefully) indistinguishable output.
|
||||
, allowDocBook ? true
|
||||
# whether lib.mdDoc is required for descriptions to be read as markdown.
|
||||
# !!! when this is eventually flipped to true, `lib.doRename` should also default to emitting Markdown
|
||||
, markdownByDefault ? false
|
||||
}:
|
||||
|
||||
@@ -130,6 +131,8 @@ in rec {
|
||||
if baseOptionsJSON == null
|
||||
then builtins.toFile "base.json" "{}"
|
||||
else baseOptionsJSON;
|
||||
|
||||
MANPAGE_URLS = pkgs.path + "/doc/manpage-urls.json";
|
||||
}
|
||||
''
|
||||
# Export list of options in different format.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import collections
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, Dict, List
|
||||
|
||||
@@ -46,6 +47,8 @@ def unpivot(options: Dict[Key, Option]) -> Dict[str, JSON]:
|
||||
result[opt.name] = opt.value
|
||||
return result
|
||||
|
||||
manpage_urls = json.load(open(os.getenv('MANPAGE_URLS')))
|
||||
|
||||
admonitions = {
|
||||
'.warning': 'warning',
|
||||
'.important': 'important',
|
||||
@@ -119,9 +122,14 @@ class Renderer(mistune.renderers.BaseRenderer):
|
||||
def env(self, text):
|
||||
return f"<envar>{escape(text)}</envar>"
|
||||
def manpage(self, page, section):
|
||||
man = f"{page}({section})"
|
||||
title = f"<refentrytitle>{escape(page)}</refentrytitle>"
|
||||
vol = f"<manvolnum>{escape(section)}</manvolnum>"
|
||||
return f"<citerefentry>{title}{vol}</citerefentry>"
|
||||
ref = f"<citerefentry>{title}{vol}</citerefentry>"
|
||||
if man in manpage_urls:
|
||||
return self.link(manpage_urls[man], text=ref)
|
||||
else:
|
||||
return ref
|
||||
|
||||
def finalize(self, data):
|
||||
return "".join(data)
|
||||
|
||||
@@ -60,7 +60,7 @@ in rec {
|
||||
`asDropin` creates a drop-in file named `overrides.conf`.
|
||||
Mainly needed to define instances for systemd template units (e.g. `systemd-nspawn@mycontainer.service`).
|
||||
|
||||
See also systemd.unit(1).
|
||||
See also {manpage}`systemd.unit(5)`.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -86,7 +86,7 @@ in rec {
|
||||
|
||||
This option creates a `.wants` symlink in the given target that exists
|
||||
statelessly without the need for running `systemctl enable`.
|
||||
The in systemd.unit(5) manpage described `[Install]` section however is
|
||||
The `[Install]` section described in {manpage}`systemd.unit(5)` however is
|
||||
not supported because it is a stateful process that does not fit well
|
||||
into the NixOS design.
|
||||
'';
|
||||
|
||||
@@ -132,7 +132,7 @@ in
|
||||
OnCalendar = "daily";
|
||||
};
|
||||
description = lib.mdDoc ''
|
||||
When to run the backup. See man systemd.timer for details.
|
||||
When to run the backup. See {manpage}`systemd.timer(5)` for details.
|
||||
'';
|
||||
example = {
|
||||
OnCalendar = "00:05";
|
||||
|
||||
@@ -79,7 +79,7 @@ in {
|
||||
example = [ "53" ];
|
||||
description = lib.mdDoc ''
|
||||
What addresses and ports the server should listen on.
|
||||
For detailed syntax see ListenStream in man systemd.socket.
|
||||
For detailed syntax see ListenStream in {manpage}`systemd.socket(5)`.
|
||||
'';
|
||||
};
|
||||
listenTLS = mkOption {
|
||||
@@ -88,7 +88,7 @@ in {
|
||||
example = [ "198.51.100.1:853" "[2001:db8::1]:853" "853" ];
|
||||
description = lib.mdDoc ''
|
||||
Addresses and ports on which kresd should provide DNS over TLS (see RFC 7858).
|
||||
For detailed syntax see ListenStream in man systemd.socket.
|
||||
For detailed syntax see ListenStream in {manpage}`systemd.socket(5)`.
|
||||
'';
|
||||
};
|
||||
listenDoH = mkOption {
|
||||
@@ -97,7 +97,7 @@ in {
|
||||
example = [ "198.51.100.1:443" "[2001:db8::1]:443" "443" ];
|
||||
description = lib.mdDoc ''
|
||||
Addresses and ports on which kresd should provide DNS over HTTPS/2 (see RFC 8484).
|
||||
For detailed syntax see ListenStream in man systemd.socket.
|
||||
For detailed syntax see ListenStream in {manpage}`systemd.socket(5)`.
|
||||
'';
|
||||
};
|
||||
instances = mkOption {
|
||||
|
||||
@@ -62,11 +62,10 @@ in
|
||||
};
|
||||
|
||||
packageFirewall = mkOption {
|
||||
default = pkgs.iptables;
|
||||
defaultText = literalExpression "pkgs.iptables";
|
||||
default = config.networking.firewall.package;
|
||||
defaultText = literalExpression "config.networking.firewall.package";
|
||||
type = types.package;
|
||||
example = literalExpression "pkgs.nftables";
|
||||
description = lib.mdDoc "The firewall package used by fail2ban service.";
|
||||
description = lib.mdDoc "The firewall package used by fail2ban service. Defaults to the package for your firewall (iptables or nftables).";
|
||||
};
|
||||
|
||||
extraPackages = mkOption {
|
||||
@@ -86,24 +85,24 @@ in
|
||||
};
|
||||
|
||||
banaction = mkOption {
|
||||
default = "iptables-multiport";
|
||||
default = if config.networking.nftables.enable then "nftables-multiport" else "iptables-multiport";
|
||||
defaultText = literalExpression '' if config.networking.nftables.enable then "nftables-multiport" else "iptables-multiport" '';
|
||||
type = types.str;
|
||||
example = "nftables-multiport";
|
||||
description = lib.mdDoc ''
|
||||
Default banning action (e.g. iptables, iptables-new, iptables-multiport,
|
||||
iptables-ipset-proto6-allports, shorewall, etc) It is used to
|
||||
iptables-ipset-proto6-allports, shorewall, etc). It is used to
|
||||
define action_* variables. Can be overridden globally or per
|
||||
section within jail.local file
|
||||
'';
|
||||
};
|
||||
|
||||
banaction-allports = mkOption {
|
||||
default = "iptables-allport";
|
||||
default = if config.networking.nftables.enable then "nftables-allport" else "iptables-allport";
|
||||
defaultText = literalExpression '' if config.networking.nftables.enable then "nftables-allport" else "iptables-allport" '';
|
||||
type = types.str;
|
||||
example = "nftables-allport";
|
||||
description = lib.mdDoc ''
|
||||
Default banning action (e.g. iptables, iptables-new, iptables-multiport,
|
||||
shorewall, etc) It is used to define action_* variables. Can be overridden
|
||||
shorewall, etc) for "allports" jails. It is used to define action_* variables. Can be overridden
|
||||
globally or per section within jail.local file
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -46,7 +46,7 @@ in {
|
||||
type = types.lines;
|
||||
example = "DefaultCPUAccounting=yes";
|
||||
description = lib.mdDoc ''
|
||||
Extra config options for systemd user instances. See man systemd-user.conf for
|
||||
Extra config options for systemd user instances. See {manpage}`systemd-user.conf(5)` for
|
||||
available options.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -13,8 +13,12 @@ sub atomicSymlink {
|
||||
my $tmp = "$target.tmp";
|
||||
unlink $tmp;
|
||||
symlink $source, $tmp or return 0;
|
||||
rename $tmp, $target or return 0;
|
||||
return 1;
|
||||
if (rename $tmp, $target) {
|
||||
return 1;
|
||||
} else {
|
||||
unlink $tmp;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +91,12 @@ my @copied;
|
||||
|
||||
sub link {
|
||||
my $fn = substr $File::Find::name, length($etc) + 1 or next;
|
||||
|
||||
# nixos-enter sets up /etc/resolv.conf as a bind mount, so skip it.
|
||||
if ($fn eq "resolv.conf" and $ENV{'IN_NIXOS_ENTER'}) {
|
||||
return;
|
||||
}
|
||||
|
||||
my $target = "/etc/$fn";
|
||||
File::Path::make_path(dirname $target);
|
||||
$created{$fn} = 1;
|
||||
@@ -103,7 +113,7 @@ sub link {
|
||||
if (-e "$_.mode") {
|
||||
my $mode = read_file("$_.mode"); chomp $mode;
|
||||
if ($mode eq "direct-symlink") {
|
||||
atomicSymlink readlink("$static/$fn"), $target or warn;
|
||||
atomicSymlink readlink("$static/$fn"), $target or warn "could not create symlink $target";
|
||||
} else {
|
||||
my $uid = read_file("$_.uid"); chomp $uid;
|
||||
my $gid = read_file("$_.gid"); chomp $gid;
|
||||
@@ -112,12 +122,15 @@ sub link {
|
||||
$gid = getgrnam $gid unless $gid =~ /^\+/;
|
||||
chown int($uid), int($gid), "$target.tmp" or warn;
|
||||
chmod oct($mode), "$target.tmp" or warn;
|
||||
rename "$target.tmp", $target or warn;
|
||||
unless (rename "$target.tmp", $target) {
|
||||
warn "could not create target $target";
|
||||
unlink "$target.tmp";
|
||||
}
|
||||
}
|
||||
push @copied, $fn;
|
||||
print CLEAN "$fn\n";
|
||||
} elsif (-l "$_") {
|
||||
atomicSymlink "$static/$fn", $target or warn;
|
||||
atomicSymlink "$static/$fn", $target or warn "could not create symlink $target";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user