Merge pull request #223730 from zendo/clash-verge-module

nixos/clash-verge: init module
This commit is contained in:
Nick Cao 2023-04-15 22:00:55 +08:00 committed by GitHub
commit 7a2fcddf52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 0 deletions

View file

@ -40,6 +40,8 @@ In addition to numerous new and upgraded packages, this release has the followin
- [cups-pdf-to-pdf](https://github.com/alexivkin/CUPS-PDF-to-PDF), a pdf-generating cups backend based on [cups-pdf](https://www.cups-pdf.de/). Available as [services.printing.cups-pdf](#opt-services.printing.cups-pdf.enable).
- [clash-verge](https://github.com/zzzgydi/clash-verge), A Clash GUI based on tauri. Available as [programs.clash-verge](#opt-programs.clash-verge.enable).
- [Cloudlog](https://www.magicbug.co.uk/cloudlog/), a web-based Amateur Radio logging application. Available as [services.cloudlog](#opt-services.cloudlog.enable).
- [fzf](https://github.com/junegunn/fzf), a command line fuzzyfinder. Available as [programs.fzf](#opt-programs.fzf.fuzzyCompletion).

View file

@ -149,6 +149,7 @@
./programs/cdemu.nix
./programs/cfs-zen-tweaks.nix
./programs/chromium.nix
./programs/clash-verge.nix
./programs/cnping.nix
./programs/command-not-found/command-not-found.nix
./programs/criu.nix

View file

@ -0,0 +1,41 @@
{ config, lib, pkgs, ... }:
{
options.programs.clash-verge = {
enable = lib.mkEnableOption (lib.mdDoc ''
Clash Verge.
'');
autoStart = lib.mkEnableOption (lib.mdDoc ''
Clash Verge Auto Launch.
'');
tunMode = lib.mkEnableOption (lib.mdDoc ''
Clash Verge Tun Mode.
'');
};
config =
let
cfg = config.programs.clash-verge;
in
lib.mkIf cfg.enable {
environment.systemPackages = [
pkgs.clash-verge
(lib.mkIf cfg.autoStart (pkgs.makeAutostartItem {
name = "clash-verge";
package = pkgs.clash-verge;
}))
];
security.wrappers.clash-verge = lib.mkIf cfg.tunMode {
owner = "root";
group = "root";
capabilities = "cap_net_bind_service,cap_net_admin=+ep";
source = "${lib.getExe pkgs.clash-verge}";
};
};
meta.maintainers = with lib.maintainers; [ zendo ];
}