2024-05-12 14:48:12 -06:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
cfg = config.programs.localsend;
|
|
|
|
firewallPort = 53317;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.programs.localsend = {
|
|
|
|
enable = lib.mkEnableOption "localsend, an open source cross-platform alternative to AirDrop";
|
|
|
|
|
2024-08-09 09:16:10 -06:00
|
|
|
package = lib.mkPackageOption pkgs "localsend" { };
|
|
|
|
|
|
|
|
openFirewall =
|
|
|
|
lib.mkEnableOption "opening the firewall port ${toString firewallPort} for receiving files"
|
|
|
|
// {
|
|
|
|
default = true;
|
|
|
|
};
|
2024-05-12 14:48:12 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
2024-08-09 09:16:10 -06:00
|
|
|
environment.systemPackages = [ cfg.package ];
|
2024-05-12 14:48:12 -06:00
|
|
|
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [ firewallPort ];
|
2024-08-09 09:16:30 -06:00
|
|
|
networking.firewall.allowedUDPPorts = lib.optionals cfg.openFirewall [ firewallPort ];
|
2024-05-12 14:48:12 -06:00
|
|
|
};
|
2024-07-11 14:29:40 -06:00
|
|
|
|
|
|
|
meta.maintainers = with lib.maintainers; [ pandapip1 ];
|
2024-05-12 14:48:12 -06:00
|
|
|
}
|