Merge remote-tracking branch 'origin/master' into staging-next
Conflicts: pkgs/applications/terminal-emulators/alacritty/default.nix pkgs/servers/clickhouse/default.nix
This commit is contained in:
@@ -62,7 +62,7 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
enable = mkEnableOption "Whether to enable Kubernetes addon manager.";
|
||||
enable = mkEnableOption "Kubernetes addon manager.";
|
||||
};
|
||||
|
||||
###### implementation
|
||||
|
||||
@@ -42,6 +42,7 @@ with lib;
|
||||
User = "clickhouse";
|
||||
Group = "clickhouse";
|
||||
ConfigurationDirectory = "clickhouse-server";
|
||||
AmbientCapabilities = "CAP_SYS_NICE";
|
||||
StateDirectory = "clickhouse";
|
||||
LogsDirectory = "clickhouse";
|
||||
ExecStart = "${pkgs.clickhouse}/bin/clickhouse-server --config-file=${pkgs.clickhouse}/etc/clickhouse-server/config.xml";
|
||||
|
||||
@@ -3,43 +3,10 @@
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.netatalk;
|
||||
|
||||
extmapFile = pkgs.writeText "extmap.conf" cfg.extmap;
|
||||
|
||||
afpToString = x: if builtins.typeOf x == "bool"
|
||||
then boolToString x
|
||||
else toString x;
|
||||
|
||||
volumeConfig = name:
|
||||
let vol = getAttr name cfg.volumes; in
|
||||
"[${name}]\n " + (toString (
|
||||
map
|
||||
(key: "${key} = ${afpToString (getAttr key vol)}\n")
|
||||
(attrNames vol)
|
||||
));
|
||||
|
||||
afpConf = ''[Global]
|
||||
extmap file = ${extmapFile}
|
||||
afp port = ${toString cfg.port}
|
||||
|
||||
${cfg.extraConfig}
|
||||
|
||||
${if cfg.homes.enable then ''[Homes]
|
||||
${optionalString (cfg.homes.path != "") "path = ${cfg.homes.path}"}
|
||||
basedir regex = ${cfg.homes.basedirRegex}
|
||||
${cfg.homes.extraConfig}
|
||||
'' else ""}
|
||||
|
||||
${toString (map volumeConfig (attrNames cfg.volumes))}
|
||||
'';
|
||||
|
||||
afpConfFile = pkgs.writeText "afp.conf" afpConf;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
settingsFormat = pkgs.formats.ini { };
|
||||
afpConfFile = settingsFormat.generate "afp.conf" cfg.settings;
|
||||
in {
|
||||
options = {
|
||||
services.netatalk = {
|
||||
|
||||
@@ -51,61 +18,24 @@ in
|
||||
description = "TCP port to be used for AFP.";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = "uam list = uams_guest.so";
|
||||
description = ''
|
||||
Lines of configuration to add to the <literal>[Global]</literal> section.
|
||||
See <literal>man apf.conf</literal> for more information.
|
||||
'';
|
||||
};
|
||||
|
||||
homes = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable sharing of the UNIX server user home directories.";
|
||||
};
|
||||
|
||||
path = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
example = "afp-data";
|
||||
description = "Share not the whole user home but this subdirectory path.";
|
||||
};
|
||||
|
||||
basedirRegex = mkOption {
|
||||
example = "/home";
|
||||
type = types.str;
|
||||
description = "Regex which matches the parent directory of the user homes.";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Lines of configuration to add to the <literal>[Homes]</literal> section.
|
||||
See <literal>man apf.conf</literal> for more information.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
volumes = mkOption {
|
||||
settings = mkOption {
|
||||
inherit (settingsFormat) type;
|
||||
default = { };
|
||||
type = types.attrsOf (types.attrsOf types.unspecified);
|
||||
description =
|
||||
''
|
||||
Set of AFP volumes to export.
|
||||
See <literal>man apf.conf</literal> for more information.
|
||||
'';
|
||||
example = literalExample ''
|
||||
{ srv =
|
||||
{ path = "/srv";
|
||||
"read only" = true;
|
||||
"hosts allow" = "10.1.0.0/16 10.2.1.100 2001:0db8:1234::/48";
|
||||
};
|
||||
}
|
||||
example = {
|
||||
Global = { "uam list" = "uams_guest.so"; };
|
||||
Homes = {
|
||||
path = "afp-data";
|
||||
"basedir regex" = "/home";
|
||||
};
|
||||
example-volume = {
|
||||
path = "/srv/volume";
|
||||
"read only" = true;
|
||||
};
|
||||
};
|
||||
description = ''
|
||||
Configuration for Netatalk. See
|
||||
<citerefentry><refentrytitle>afp.conf</refentrytitle>
|
||||
<manvolnum>5</manvolnum></citerefentry>.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -114,18 +44,33 @@ in
|
||||
default = "";
|
||||
description = ''
|
||||
File name extension mappings.
|
||||
See <literal>man extmap.conf</literal> for more information.
|
||||
See <citerefentry><refentrytitle>extmap.conf</refentrytitle>
|
||||
<manvolnum>5</manvolnum></citerefentry>. for more information.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
imports = (map (option:
|
||||
mkRemovedOptionModule [ "services" "netatalk" option ]
|
||||
"This option was removed in favor of `services.netatalk.settings`.") [
|
||||
"extraConfig"
|
||||
"homes"
|
||||
"volumes"
|
||||
]);
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
services.netatalk.settings.Global = {
|
||||
"afp port" = toString cfg.port;
|
||||
"extmap file" = "${pkgs.writeText "extmap.conf" cfg.extmap}";
|
||||
};
|
||||
|
||||
systemd.services.netatalk = {
|
||||
description = "Netatalk AFP fileserver for Macintosh clients";
|
||||
unitConfig.Documentation = "man:afp.conf(5) man:netatalk(8) man:afpd(8) man:cnid_metad(8) man:cnid_dbd(8)";
|
||||
unitConfig.Documentation =
|
||||
"man:afp.conf(5) man:netatalk(8) man:afpd(8) man:cnid_metad(8) man:cnid_dbd(8)";
|
||||
after = [ "network.target" "avahi-daemon.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
@@ -135,12 +80,12 @@ in
|
||||
Type = "forking";
|
||||
GuessMainPID = "no";
|
||||
PIDFile = "/run/lock/netatalk";
|
||||
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -m 0755 -p /var/lib/netatalk/CNID";
|
||||
ExecStart = "${pkgs.netatalk}/sbin/netatalk -F ${afpConfFile}";
|
||||
ExecStart = "${pkgs.netatalk}/sbin/netatalk -F ${afpConfFile}";
|
||||
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
||||
ExecStop = "${pkgs.coreutils}/bin/kill -TERM $MAINPID";
|
||||
ExecStop = "${pkgs.coreutils}/bin/kill -TERM $MAINPID";
|
||||
Restart = "always";
|
||||
RestartSec = 1;
|
||||
StateDirectory = [ "netatalk/CNID" ];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@@ -20,6 +20,15 @@ let
|
||||
|
||||
mkZoneFileName = name: if name == "." then "root" else name;
|
||||
|
||||
# replaces include: directives for keys with fake keys for nsd-checkconf
|
||||
injectFakeKeys = keys: concatStrings
|
||||
(mapAttrsToList
|
||||
(keyName: keyOptions: ''
|
||||
fakeKey="$(${pkgs.bind}/bin/tsig-keygen -a ${escapeShellArgs [ keyOptions.algorithm keyName ]} | grep -oP "\s*secret \"\K.*(?=\";)")"
|
||||
sed "s@^\s*include:\s*\"${stateDir}/private/${keyName}\"\$@secret: $fakeKey@" -i $out/nsd.conf
|
||||
'')
|
||||
keys);
|
||||
|
||||
nsdEnv = pkgs.buildEnv {
|
||||
name = "nsd-env";
|
||||
|
||||
@@ -34,9 +43,9 @@ let
|
||||
echo "|- checking zone '$out/zones/$zoneFile'"
|
||||
${nsdPkg}/sbin/nsd-checkzone "$zoneFile" "$zoneFile" || {
|
||||
if grep -q \\\\\\$ "$zoneFile"; then
|
||||
echo zone "$zoneFile" contains escaped dollar signes \\\$
|
||||
echo Escaping them is not needed any more. Please make shure \
|
||||
to unescape them where they prefix a variable name
|
||||
echo zone "$zoneFile" contains escaped dollar signs \\\$
|
||||
echo Escaping them is not needed any more. Please make sure \
|
||||
to unescape them where they prefix a variable name.
|
||||
fi
|
||||
|
||||
exit 1
|
||||
@@ -44,7 +53,14 @@ let
|
||||
done
|
||||
|
||||
echo "checking configuration file"
|
||||
# Save original config file including key references...
|
||||
cp $out/nsd.conf{,.orig}
|
||||
# ...inject mock keys into config
|
||||
${injectFakeKeys cfg.keys}
|
||||
# ...do the checkconf
|
||||
${nsdPkg}/sbin/nsd-checkconf $out/nsd.conf
|
||||
# ... and restore original config file.
|
||||
mv $out/nsd.conf{.orig,}
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user