at master 1.4 kB view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7let 8 cfg = config.services.speedify; 9in 10{ 11 options.services.speedify = { 12 enable = lib.mkOption { 13 type = lib.types.bool; 14 default = false; 15 description = '' 16 This option enables Speedify daemon. 17 This sets {option}`networking.firewall.checkReversePath` to "loose", which might be undesirable for security. 18 ''; 19 }; 20 21 package = lib.mkPackageOption pkgs "speedify" { }; 22 }; 23 24 config = lib.mkIf cfg.enable { 25 boot.kernelModules = [ "tun" ]; 26 27 networking.firewall.checkReversePath = "loose"; 28 29 systemd.services.speedify = { 30 description = "Speedify Service"; 31 wantedBy = [ "multi-user.target" ]; 32 wants = [ 33 "network.target" 34 "network-online.target" 35 ]; 36 after = [ 37 "network-online.target" 38 ] 39 ++ lib.optional config.networking.networkmanager.enable "NetworkManager.service"; 40 path = [ 41 pkgs.procps 42 pkgs.nettools 43 ]; 44 serviceConfig = { 45 ExecStart = "${cfg.package}/share/speedify/SpeedifyStartup.sh"; 46 ExecStop = "${cfg.package}/share/speedify/SpeedifyShutdown.sh"; 47 Restart = "on-failure"; 48 RestartSec = 5; 49 TimeoutStartSec = 30; 50 TimeoutStopSec = 30; 51 Type = "forking"; 52 }; 53 }; 54 }; 55 56 meta.maintainers = with lib.maintainers; [ 57 zahrun 58 ]; 59}