at 25.11-pre 1.1 kB view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7let 8 cfg = config.services.fireqos; 9 fireqosConfig = pkgs.writeText "fireqos.conf" cfg.config; 10in 11{ 12 options.services.fireqos = { 13 enable = lib.mkEnableOption "FireQOS"; 14 15 config = lib.mkOption { 16 type = lib.types.lines; 17 example = '' 18 interface wlp3s0 world-in input rate 10mbit ethernet 19 class web commit 50kbit 20 match tcp ports 80,443 21 22 interface wlp3s0 world-out input rate 10mbit ethernet 23 class web commit 50kbit 24 match tcp ports 80,443 25 ''; 26 description = '' 27 The FireQOS configuration. 28 ''; 29 }; 30 }; 31 32 config = lib.mkIf cfg.enable { 33 systemd.services.fireqos = { 34 description = "FireQOS"; 35 after = [ "network.target" ]; 36 wantedBy = [ "multi-user.target" ]; 37 serviceConfig = { 38 Type = "oneshot"; 39 RemainAfterExit = true; 40 ExecStart = "${pkgs.firehol}/bin/fireqos start ${fireqosConfig}"; 41 ExecStop = [ 42 "${pkgs.firehol}/bin/fireqos stop" 43 "${pkgs.firehol}/bin/fireqos clear_all_qos" 44 ]; 45 }; 46 }; 47 }; 48}