···
cfg = config.services.netatalk;
-
extmapFile = pkgs.writeText "extmap.conf" cfg.extmap;
-
afpToString = x: if builtins.typeOf x == "bool"
-
let vol = getAttr name cfg.volumes; in
-
"[${name}]\n " + (toString (
-
(key: "${key} = ${afpToString (getAttr key vol)}\n")
-
extmap file = ${extmapFile}
-
afp port = ${toString cfg.port}
-
${if cfg.homes.enable then ''[Homes]
-
${optionalString (cfg.homes.path != "") "path = ${cfg.homes.path}"}
-
basedir regex = ${cfg.homes.basedirRegex}
-
${cfg.homes.extraConfig}
-
${toString (map volumeConfig (attrNames cfg.volumes))}
-
afpConfFile = pkgs.writeText "afp.conf" afpConf;
···
description = "TCP port to be used for AFP.";
-
extraConfig = mkOption {
-
example = "uam list = uams_guest.so";
-
Lines of configuration to add to the <literal>[Global]</literal> section.
-
See <literal>man apf.conf</literal> for more information.
-
description = "Enable sharing of the UNIX server user home directories.";
-
description = "Share not the whole user home but this subdirectory path.";
-
basedirRegex = mkOption {
-
description = "Regex which matches the parent directory of the user homes.";
-
extraConfig = mkOption {
-
Lines of configuration to add to the <literal>[Homes]</literal> section.
-
See <literal>man apf.conf</literal> for more information.
-
type = types.attrsOf (types.attrsOf types.unspecified);
-
Set of AFP volumes to export.
-
See <literal>man apf.conf</literal> for more information.
-
example = literalExample ''
-
"hosts allow" = "10.1.0.0/16 10.2.1.100 2001:0db8:1234::/48";
···
File name extension mappings.
-
See <literal>man extmap.conf</literal> for more information.
config = mkIf cfg.enable {
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)";
after = [ "network.target" "avahi-daemon.service" ];
wantedBy = [ "multi-user.target" ];
···
PIDFile = "/run/lock/netatalk";
-
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -m 0755 -p /var/lib/netatalk/CNID";
-
ExecStart = "${pkgs.netatalk}/sbin/netatalk -F ${afpConfFile}";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
-
ExecStop = "${pkgs.coreutils}/bin/kill -TERM $MAINPID";