anchor.diff:  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 = {
   
  
positive.code:         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}";
          ExecReload = "${pkgs.coreutils}/bin/kill -HUP  $MAINPID";
          ExecStop   = "${pkgs.coreutils}/bin/kill -TERM $MAINPID";
          Restart = "always";
          RestartSec = 1;
        };
  
      };
  
negative.code:         description = "TCP port to be used for AFP.";
        };
  
        settings = mkOption {
          inherit (settingsFormat) type;
          default = { };
          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>.
          '';
        };
  
  