From 0a5801395a69ae214be3faf5fc67e2a866ea4117 Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Sun, 10 Mar 2024 20:03:25 +0100 Subject: [PATCH 1/6] nixos/clash-verge: add cfg.package --- nixos/modules/programs/clash-verge.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nixos/modules/programs/clash-verge.nix b/nixos/modules/programs/clash-verge.nix index 57a1c0377edb..e1afafa7cadc 100644 --- a/nixos/modules/programs/clash-verge.nix +++ b/nixos/modules/programs/clash-verge.nix @@ -3,6 +3,7 @@ { options.programs.clash-verge = { enable = lib.mkEnableOption (lib.mdDoc "Clash Verge"); + package = lib.mkPackageOption pkgs "clash-verge" {}; autoStart = lib.mkEnableOption (lib.mdDoc "Clash Verge auto launch"); tunMode = lib.mkEnableOption (lib.mdDoc "Clash Verge TUN mode"); }; @@ -14,10 +15,10 @@ lib.mkIf cfg.enable { environment.systemPackages = [ - pkgs.clash-verge + cfg.package (lib.mkIf cfg.autoStart (pkgs.makeAutostartItem { name = "clash-verge"; - package = pkgs.clash-verge; + package = cfg.package; })) ]; @@ -25,7 +26,7 @@ owner = "root"; group = "root"; capabilities = "cap_net_bind_service,cap_net_admin=+ep"; - source = "${lib.getExe pkgs.clash-verge}"; + source = "${lib.getExe cfg.package}"; }; }; From ed15e72bb15fbf5a6440de360203c79e49cac60c Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Sun, 10 Mar 2024 20:04:21 +0100 Subject: [PATCH 2/6] clash-verge: move to by-name --- .../default.nix => by-name/cl/clash-verge/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{applications/networking/clash-verge/default.nix => by-name/cl/clash-verge/package.nix} (100%) diff --git a/pkgs/applications/networking/clash-verge/default.nix b/pkgs/by-name/cl/clash-verge/package.nix similarity index 100% rename from pkgs/applications/networking/clash-verge/default.nix rename to pkgs/by-name/cl/clash-verge/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ac27774ea319..ed00b913f09a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4640,8 +4640,6 @@ with pkgs; clash-geoip = callPackage ../data/misc/clash-geoip { }; - clash-verge = callPackage ../applications/networking/clash-verge { }; - clevercsv = with python3Packages; toPythonApplication clevercsv; clevis = callPackage ../tools/security/clevis { From 53548c6a8951059372d1b8717692ce547ebb1125 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Sun, 10 Mar 2024 20:14:16 +0100 Subject: [PATCH 3/6] clash-verge: don't hardcode clash-meta --- pkgs/by-name/cl/clash-verge/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/cl/clash-verge/package.nix b/pkgs/by-name/cl/clash-verge/package.nix index f83583283d4f..cd3597c513cf 100644 --- a/pkgs/by-name/cl/clash-verge/package.nix +++ b/pkgs/by-name/cl/clash-verge/package.nix @@ -42,13 +42,13 @@ stdenv.mkDerivation rec { mkdir -p $out/bin mv usr/* $out - rm $out/bin/{clash,clash-meta} runHook postInstall ''; postFixup = '' - ln -s ${lib.getExe clash-meta} $out/bin/clash-meta + rm -f $out/bin/clash + ln -sf ${lib.getExe clash-meta} $out/bin/${clash-meta.meta.mainProgram} ''; meta = with lib; { From 64cb4fffac1bd6eaacdbb039efddf71235af68a2 Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Sun, 10 Mar 2024 20:02:08 +0100 Subject: [PATCH 4/6] maintainers: add Guanran928 --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 681e68781e55..f174f302c323 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -7427,6 +7427,12 @@ githubId = 21156405; name = "GuangTao Zhang"; }; + Guanran928 = { + email = "guanran928@outlook.com"; + github = "Guanran928"; + githubId = 68757440; + name = "Guanran928"; + }; guekka = { github = "Guekka"; githubId = 39066502; From 30d300e27b8bc0699cfa2f367063b2714a68040a Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Sun, 10 Mar 2024 20:15:29 +0100 Subject: [PATCH 5/6] clash-verge-rev: init at 1.5.4 --- pkgs/by-name/cl/clash-verge-rev/package.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pkgs/by-name/cl/clash-verge-rev/package.nix diff --git a/pkgs/by-name/cl/clash-verge-rev/package.nix b/pkgs/by-name/cl/clash-verge-rev/package.nix new file mode 100644 index 000000000000..d415428e7299 --- /dev/null +++ b/pkgs/by-name/cl/clash-verge-rev/package.nix @@ -0,0 +1,19 @@ +{ lib +, clash-verge +, fetchurl +}: + +clash-verge.overrideAttrs (old: rec { + pname = "clash-verge-rev"; + version = "1.5.4"; + + src = fetchurl { + url = "https://github.com/clash-verge-rev/clash-verge-rev/releases/download/v${version}/clash-verge_${version}_amd64.deb"; + hash = "sha256-UJYLfefgUASBmh0gyNmjsWdAadluKhwaXZL1wlVlbjU="; + }; + + meta = old.meta // (with lib; { + homepage = "https://github.com/clash-verge-rev/clash-verge-rev"; + maintainers = with maintainers; [ Guanran928 ]; + }); +}) From 78c63804e94ffbef63c070d0bd94990e70d85c9d Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Sun, 10 Mar 2024 20:15:06 +0100 Subject: [PATCH 6/6] clash-nyanpasu: init at 1.4.5 --- pkgs/by-name/cl/clash-nyanpasu/package.nix | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 pkgs/by-name/cl/clash-nyanpasu/package.nix diff --git a/pkgs/by-name/cl/clash-nyanpasu/package.nix b/pkgs/by-name/cl/clash-nyanpasu/package.nix new file mode 100644 index 000000000000..90da8892b094 --- /dev/null +++ b/pkgs/by-name/cl/clash-nyanpasu/package.nix @@ -0,0 +1,23 @@ +{ lib +, clash-verge +, mihomo +, fetchurl +}: + +(clash-verge.override { + clash-meta = mihomo; +}).overrideAttrs (old: rec { + pname = "clash-nyanpasu"; + version = "1.4.5"; + + src = fetchurl { + url = "https://github.com/keiko233/clash-nyanpasu/releases/download/v${version}/clash-nyanpasu_${version}_amd64.deb"; + hash = "sha256-cxaq7Rndf0ytEaqc7CGQix5SOAdsTOoTj1Jlhjr5wEA="; + }; + + meta = old.meta // (with lib; { + homepage = "https://github.com/keiko233/clash-nyanpasu"; + maintainers = with maintainers; [ Guanran928 ]; + mainProgram = "clash-nyanpasu"; + }); +})