nixpkgs/nixos/modules/services/networking/fireqos.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.1 KiB
Nix
Raw Normal View History

2024-12-03 11:11:45 +01:00
{
config,
lib,
pkgs,
...
}:
2017-09-09 00:29:46 +02:00
let
cfg = config.services.fireqos;
2024-12-03 11:11:45 +01:00
fireqosConfig = pkgs.writeText "fireqos.conf" cfg.config;
in
{
2017-09-09 00:29:46 +02:00
options.services.fireqos = {
2024-12-03 11:11:45 +01:00
enable = lib.mkEnableOption "FireQOS";
2017-09-09 00:29:46 +02:00
config = lib.mkOption {
2024-12-03 11:11:45 +01:00
type = lib.types.lines;
2017-09-09 00:29:46 +02:00
example = ''
interface wlp3s0 world-in input rate 10mbit ethernet
class web commit 50kbit
match tcp ports 80,443
interface wlp3s0 world-out input rate 10mbit ethernet
class web commit 50kbit
match tcp ports 80,443
'';
description = ''
2024-12-03 11:11:45 +01:00
The FireQOS configuration.
2017-09-09 00:29:46 +02:00
'';
};
};
config = lib.mkIf cfg.enable {
2017-09-09 00:29:46 +02:00
systemd.services.fireqos = {
description = "FireQOS";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
2017-09-09 00:29:46 +02:00
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${pkgs.firehol}/bin/fireqos start ${fireqosConfig}";
ExecStop = [
"${pkgs.firehol}/bin/fireqos stop"
"${pkgs.firehol}/bin/fireqos clear_all_qos"
];
};
};
};
}