anchor.diff:    inherit (lib)
       concatStringsSep
       mkIf
  -    mkMerge
       mkOption
       optionals
       optionalAttrs;
  
positive.code:       Discovery.MDNS.Enabled = false;
        Swarm.AddrFilters = filterAddrs;
        Experimental.QUIC = cfg.quic;
      }
      cfg.extraAttrs
    ];
  
    extraJson = pkgs.writeText "ipfs-extra.json" (builtins.toJSON ipfsAttrs);
  
    extraFlags = [
    ] ++ optionals cfg.gc [
      "--enable-gc"
    ];
  in
  {
    options = {
  
      services.ipfs = {
  
        enable = mkOption {
          type = bool;
          default = false;
          description = ''
            Enable the ipfs daemon process.
          '';
        };
  
        quic = mkOption {
          type = bool;
          default = true;
          description = ''
            Enable the experimental QUIC protocol.
          '';
        };
  
        privateAddresses = mkOption {
          type = bool;
          default = false;
          description = ''
            Should we allow and advertise private addresses.
          '';
        };
  
        gc = mkOption {
          type = bool;
          default = true;
          description = ''
            Enable the periodic garbage collector.
          '';
        };
  
        extraAttrs = mkOption {
          type = attrs;
          default = { };
          description = ''
            Extra attrs to pass when generating the JSON config.
          '';
        };
  
      };
  
    };
  
    config = mkIf cfg.enable {
  
      environment.variables = {
        IPFS_PATH = "/var/lib/ipfs";
      };
  
      networking.proxy.envVars.IPFS_API = "127.0.0.1:8001";
  
      systemd.services.ipfs = {
        wantedBy = [ "multi-user.target" ];
  
negative.code: 
    filterAddrs = if cfg.privateAddresses then [ ] else privateAddrs;
  
    extraJson = pkgs.writeText "ipfs-extra.json" (builtins.toJSON cfg.extraAttrs);
  
    extraFlags = [
    ] ++ optionals cfg.gc [
      "--enable-gc"
    ];
  in
  {
    options = {
  
      services.ipfs = {
  
        enable = mkOption {
          type = bool;
          default = false;
          description = ''
            Enable the ipfs daemon process.
          '';
        };
  
        quic = mkOption {
          type = bool;
          default = true;
          description = ''
            Enable the experimental QUIC protocol.
          '';
        };
  
        privateAddresses = mkOption {
          type = bool;
          default = false;
          description = ''
            Should we allow and advertise private addresses.
          '';
        };
  
        gc = mkOption {
          type = bool;
          default = true;
          description = ''
            Enable the periodic garbage collector.
          '';
        };
  
        extraAttrs = mkOption {
          type = attrs;
          default = { };
          description = ''
            Extra attrs to pass when generating the JSON config.
          '';
        };
  
      };
  
    };
  
    config = mkIf cfg.enable {
  
      environment.variables = {
        IPFS_PATH = "/var/lib/ipfs";
      };
  
      networking.proxy.envVars.IPFS_API = "127.0.0.1:8001";
  
      services.ipfs.extraAttrs = {
        Addresses = {
          Swarm = [
            "/ip4/0.0.0.0/tcp/4001"
  