{ inputs, ... }: {
  flake-file.inputs.copyparty = {
    url = "github:9001/copyparty";
    inputs.nixpkgs.follows = "nixpkgs";
  };

  den.aspects.services.copyparty = let port = 3210; in {
    tunnel = { subdomain = "files"; inherit port; };

    nixos = { host, config, ... }: let user = host.owner; home = config.users.users.${user}.home; in {
      imports = [ inputs.copyparty.nixosModules.default ];

      nixpkgs.overlays = [ inputs.copyparty.overlays.default ];

      services.copyparty = {
        enable = true;

        inherit user;
        group = "copyparty";

        settings = {
          i = "0.0.0.0";
          p = [ port (port + 1) ];
          no-reload = true;
          ignored-flag = false;
        };

        accounts = {
          ${user} = {
            passwordFile = "${home}/copyparty/${user}.passwd";
          };
          geecee = {
            passwordFile = "${home}/copyparty/geecee.passwd";
          };
        };

        groups = {
          g1 = [ user ];
        };

        volumes = {
          "/" = {
            path = "${home}/copyparty/public/";

            access = {
              r = "*";
              rwdma = [ user ];
            };

            flags = {
              fk = 4;
              scan = 60;
            };
          };

          "/slsk" = {
            path = "${home}/slskd/complete/";

            access = {
              r = "*";
              rwdma = [ user ];
            };

            flags = {
              fk = 4;
              scan = 60;
            };
          };

          "/nix" = {
            path = "${home}/nix/";

            access = {
              r = "*";
            };

            flags = {
              fk = 4;
              scan = 60;
            };
          };

          "/Music" = {
            path = "${home}/media/music/";

            access = {
              r = "*";
              rwdma = [ user ];
            };

            flags = {
              fk = 4;
              scan = 60;
            };
          };

          "/geecee" = {
            path = "${home}/dev/discord/discord-archive/";

            access = {
              r = [ "geecee" ];
              rwdma = [ user ];
            };

            flags = {
              fk = 4;
              scan = 60;
            };
          };
        };

        openFilesLimit = 8192;
      };
    };
  };
}
