nixpkgs/nixos/modules/programs/clash-verge.nix

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

35 lines
884 B
Nix
Raw Normal View History

2023-03-27 08:18:13 +02:00
{ config, lib, pkgs, ... }:
{
options.programs.clash-verge = {
enable = lib.mkEnableOption "Clash Verge";
2024-03-10 20:03:25 +01:00
package = lib.mkPackageOption pkgs "clash-verge" {};
autoStart = lib.mkEnableOption "Clash Verge auto launch";
tunMode = lib.mkEnableOption "Clash Verge TUN mode";
2023-03-27 08:18:13 +02:00
};
config =
let
cfg = config.programs.clash-verge;
in
lib.mkIf cfg.enable {
environment.systemPackages = [
2024-03-10 20:03:25 +01:00
cfg.package
2023-03-27 08:18:13 +02:00
(lib.mkIf cfg.autoStart (pkgs.makeAutostartItem {
name = "clash-verge";
2024-03-10 20:03:25 +01:00
package = cfg.package;
2023-03-27 08:18:13 +02:00
}))
];
security.wrappers.clash-verge = lib.mkIf cfg.tunMode {
owner = "root";
group = "root";
capabilities = "cap_net_bind_service,cap_net_admin=+ep";
2024-03-10 20:03:25 +01:00
source = "${lib.getExe cfg.package}";
2023-03-27 08:18:13 +02:00
};
};
meta.maintainers = with lib.maintainers; [ zendo ];
}