nixos/clash-verge: enable serviceModule by default

This commit is contained in:
wxt 2024-11-25 18:01:42 +08:00
parent 68107bed79
commit 6817299f38
No known key found for this signature in database
GPG Key ID: F62181757D8BF693
2 changed files with 21 additions and 8 deletions

View File

@ -135,6 +135,8 @@
- `zf` was updated to 0.10.2, which includes breaking changes from the [0.10.0 release](https://github.com/natecraddock/zf/releases/tag/0.10.0).
`zf` no longer does Unicode normalization of the input and no longer supports terminal escape sequences in the `ZF_PROMPT` environment variable.
- `programs.clash-verge.tunMode` was deprecated and removed because now service mode is neccessary to start program. Without `programs.clash-verge.enable`, clash-verge-rev will refuse to start.
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
## Other Notable Changes {#sec-release-25.05-notable-changes}

View File

@ -6,6 +6,11 @@
}:
{
imports = [
(lib.mkRemovedOptionModule [ "programs" "clash-verge" "tunMode" ] ''
The tunMode will work with service mode which is enabled by default.
'')
];
options.programs.clash-verge = {
enable = lib.mkEnableOption "Clash Verge";
package = lib.mkOption {
@ -15,10 +20,10 @@
clash-verge-rev and clash-nyanpasu, both are forks of
the original clash-verge project.
'';
example = "pkgs.clash-verge-rev";
default = pkgs.clash-verge-rev;
defaultText = lib.literalExpression "pkgs.clash-verge-rev";
};
autoStart = lib.mkEnableOption "Clash Verge auto launch";
tunMode = lib.mkEnableOption "Clash Verge TUN mode";
};
config =
@ -37,13 +42,19 @@
))
];
security.wrappers.clash-verge = lib.mkIf cfg.tunMode {
owner = "root";
group = "root";
capabilities = "cap_net_bind_service,cap_net_admin=+ep";
source = "${lib.getExe cfg.package}";
systemd.services.clash-verge = {
enable = true;
description = "Clash Verge Service Mode";
serviceConfig = {
ExecStart = "${cfg.package}/bin/clash-verge-service";
Restart = "on-failure";
};
wantedBy = [ "multi-user.target" ];
};
};
meta.maintainers = with lib.maintainers; [ zendo ];
meta.maintainers = with lib.maintainers; [
bot-wxt1221
Guanran928
];
}