netatalk: 3.1.0 -> 3.1.7, new service module

authored by Jordan Mulcahey and committed by Emery Hemingway a2b8cc0a e3aa635e

+196 -6
+1
nixos/modules/module-list.nix
··· 275 ./services/monitoring/zabbix-agent.nix 276 ./services/monitoring/zabbix-server.nix 277 ./services/network-filesystems/drbd.nix 278 ./services/network-filesystems/nfsd.nix 279 ./services/network-filesystems/openafs-client/default.nix 280 ./services/network-filesystems/rsyncd.nix
··· 275 ./services/monitoring/zabbix-agent.nix 276 ./services/monitoring/zabbix-server.nix 277 ./services/network-filesystems/drbd.nix 278 + ./services/network-filesystems/netatalk.nix 279 ./services/network-filesystems/nfsd.nix 280 ./services/network-filesystems/openafs-client/default.nix 281 ./services/network-filesystems/rsyncd.nix
+150
nixos/modules/services/network-filesystems/netatalk.nix
···
··· 1 + { config, pkgs, lib, ... }: 2 + 3 + with lib; 4 + 5 + let 6 + 7 + cfg = config.services.netatalk; 8 + 9 + extmapFile = pkgs.writeText "extmap.conf" cfg.extmap; 10 + 11 + afpToString = x: if builtins.typeOf x == "bool" 12 + then (if x then "true" else "false") 13 + else toString x; 14 + 15 + volumeConfig = name: 16 + let vol = getAttr name cfg.volumes; in 17 + "[${name}]\n " + (toString ( 18 + map 19 + (key: "${key} = ${afpToString (getAttr key vol)}\n") 20 + (attrNames vol) 21 + )); 22 + 23 + afpConf = ''[Global] 24 + extmap file = ${extmapFile} 25 + afp port = ${toString cfg.port} 26 + 27 + ${cfg.extraConfig} 28 + 29 + ${if cfg.homes.enable then ''[Homes] 30 + ${optionalString (cfg.homes.path != "") "path = ${cfg.homes.path}"} 31 + basedir regex = ${cfg.homes.basedirRegex} 32 + ${cfg.homes.extraConfig} 33 + '' else ""} 34 + 35 + ${toString (map volumeConfig (attrNames cfg.volumes))} 36 + ''; 37 + 38 + afpConfFile = pkgs.writeText "afp.conf" afpConf; 39 + 40 + in 41 + 42 + { 43 + options = { 44 + services.netatalk = { 45 + 46 + enable = mkOption { 47 + default = false; 48 + description = "Whether to enable the Netatalk AFP fileserver."; 49 + }; 50 + 51 + port = mkOption { 52 + default = 548; 53 + description = "TCP port to be used for AFP."; 54 + }; 55 + 56 + extraConfig = mkOption { 57 + type = types.lines; 58 + default = ""; 59 + example = "uam list = uams_guest.so"; 60 + description = '' 61 + Lines of configuration to add to the <literal>[Global]</literal> section. 62 + See <literal>man apf.conf</literal> for more information. 63 + ''; 64 + }; 65 + 66 + homes = { 67 + enable = mkOption { 68 + default = false; 69 + description = "Enable sharing of the UNIX server user home directories."; 70 + }; 71 + 72 + path = mkOption { 73 + default = ""; 74 + example = "afp-data"; 75 + description = "Share not the whole user home but this subdirectory path."; 76 + }; 77 + 78 + basedirRegex = mkOption { 79 + example = "/home"; 80 + description = "Regex which matches the parent directory of the user homes."; 81 + }; 82 + 83 + extraConfig = mkOption { 84 + type = types.lines; 85 + default = ""; 86 + description = '' 87 + Lines of configuration to add to the <literal>[Homes]</literal> section. 88 + See <literal>man apf.conf</literal> for more information. 89 + ''; 90 + }; 91 + }; 92 + 93 + volumes = mkOption { 94 + default = { }; 95 + type = types.attrsOf (types.attrsOf types.unspecified); 96 + description = 97 + '' 98 + Set of AFP volumes to export. 99 + See <literal>man apf.conf</literal> for more information. 100 + ''; 101 + example = 102 + { srv = 103 + { path = "/srv"; 104 + "read only" = true; 105 + "hosts allow" = "10.1.0.0/16 10.2.1.100 2001:0db8:1234::/48"; 106 + }; 107 + }; 108 + }; 109 + 110 + extmap = mkOption { 111 + type = types.lines; 112 + default = ""; 113 + description = '' 114 + File name extension mappings. 115 + See <literal>man extmap.conf</literal> for more information. 116 + ''; 117 + }; 118 + 119 + }; 120 + }; 121 + 122 + config = mkIf cfg.enable { 123 + 124 + systemd.services.netatalk = { 125 + description = "Netatalk AFP fileserver for Macintosh clients"; 126 + unitConfig.Documentation = "man:afp.conf(5) man:netatalk(8) man:afpd(8) man:cnid_metad(8) man:cnid_dbd(8)"; 127 + after = [ "network.target" "avahi-daemon.service" ]; 128 + wantedBy = [ "multi-user.target" ]; 129 + 130 + path = [ pkgs.netatalk ]; 131 + 132 + serviceConfig = { 133 + Type = "forking"; 134 + GuessMainPID = "no"; 135 + PIDFile = "/run/lock/netatalk"; 136 + ExecStartPre = "${pkgs.coreutils}/bin/mkdir -m 0755 -p /var/lib/netatalk/CNID"; 137 + ExecStart = "${pkgs.netatalk}/sbin/netatalk -F ${afpConfFile}"; 138 + ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; 139 + ExecStop = "${pkgs.coreutils}/bin/kill -TERM $MAINPID"; 140 + Restart = "always"; 141 + RestartSec = 1; 142 + }; 143 + 144 + }; 145 + 146 + security.pam.services.netatalk.unixAuth = true; 147 + 148 + }; 149 + 150 + }
+10 -6
pkgs/tools/filesystems/netatalk/default.nix
··· 1 - { fetchurl, stdenv, pkgconfig, db, libgcrypt, avahi, libiconv, pam, openssl }: 2 3 - stdenv.mkDerivation rec { 4 - name = "netatalk-3.1.0"; 5 6 src = fetchurl { 7 url = "mirror://sourceforge/netatalk/netatalk/${name}.tar.bz2"; 8 - sha256 = "1d8dc8ysslkis4yl1xab1w9p0pz7a1kg0i6fds4wxsp4fhb6wqhq"; 9 }; 10 11 - buildInputs = [ pkgconfig db libgcrypt avahi pam openssl libiconv ]; 12 13 configureFlags = [ 14 "--with-bdb=${db}" 15 "--with-openssl=${openssl}" 16 ]; 17 18 enableParallelBuild = true; 19 20 meta = { 21 - description = "Apple File Protocl Server"; 22 homepage = http://netatalk.sourceforge.net/; 23 license = stdenv.lib.licenses.gpl3; 24 platforms = stdenv.lib.platforms.linux;
··· 1 + { fetchurl, stdenv, pkgconfig, db, libgcrypt, avahi, libiconv, pam, openssl, acl }: 2 3 + stdenv.mkDerivation rec{ 4 + name = "netatalk-3.1.7"; 5 6 src = fetchurl { 7 url = "mirror://sourceforge/netatalk/netatalk/${name}.tar.bz2"; 8 + sha256 = "0wf09fyqzza024qr1s26z5x7rsvh9zb4pv598gw7gm77wjcr6174"; 9 }; 10 11 + buildInputs = [ pkgconfig db libgcrypt avahi libiconv pam openssl acl ]; 12 + 13 + patches = ./omitLocalstatedirCreation.patch; 14 15 configureFlags = [ 16 "--with-bdb=${db}" 17 "--with-openssl=${openssl}" 18 + "--with-lockfile=/run/lock/netatalk" 19 + "--localstatedir=/var/lib" 20 ]; 21 22 enableParallelBuild = true; 23 24 meta = { 25 + description = "Apple Filing Protocol Server"; 26 homepage = http://netatalk.sourceforge.net/; 27 license = stdenv.lib.licenses.gpl3; 28 platforms = stdenv.lib.platforms.linux;
+35
pkgs/tools/filesystems/netatalk/omitLocalstatedirCreation.patch
···
··· 1 + diff -ur netatalk-3.1.7-old/config/Makefile.in netatalk-3.1.7-new/config/Makefile.in 2 + --- netatalk-3.1.7-old/config/Makefile.in 2014-08-29 03:33:35.000000000 -0700 3 + +++ netatalk-3.1.7-new/config/Makefile.in 2015-08-13 20:52:35.000000000 -0700 4 + @@ -699,7 +699,7 @@ 5 + 6 + info-am: 7 + 8 + -install-data-am: install-data-local install-dbusserviceDATA 9 + +install-data-am: install-dbusserviceDATA 10 + 11 + install-dvi: install-dvi-recursive 12 + 13 + @@ -754,7 +754,7 @@ 14 + cscopelist cscopelist-recursive ctags ctags-recursive \ 15 + distclean distclean-generic distclean-libtool distclean-tags \ 16 + distdir dvi dvi-am html html-am info info-am install \ 17 + - install-am install-data install-data-am install-data-local \ 18 + + install-am install-data install-data-am \ 19 + install-dbusserviceDATA install-dvi install-dvi-am \ 20 + install-exec install-exec-am install-html install-html-am \ 21 + install-info install-info-am install-man install-pdf \ 22 + @@ -782,12 +782,6 @@ 23 + # install configuration files 24 + # 25 + 26 + -install-data-local: install-config-files 27 + - mkdir -pm 0755 $(DESTDIR)$(localstatedir)/netatalk/ 28 + - mkdir -pm 0755 $(DESTDIR)$(localstatedir)/netatalk/CNID/ 29 + - $(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(localstatedir)/netatalk/ 30 + - $(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(localstatedir)/netatalk/CNID/ 31 + - 32 + uninstall-local: 33 + @for f in $(CONFFILES) $(GENFILES); do \ 34 + echo rm -f $(DESTDIR)$(pkgconfdir)/$$f; \ 35 +