From 24bedbe75e25ebc0a7f3cfc5f123a9892fa475ac Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Mon, 8 Jul 2024 18:10:35 +0800 Subject: [PATCH] darwin: unbreak --- darwin/modules/default.nix | 2 +- .../modules/services/{clash.nix => mihomo.nix} | 16 +++++++--------- darwin/profiles/common/opt-in/gaming/default.nix | 8 -------- .../common/opt-in/gaming/home/default.nix | 5 ----- darwin/profiles/common/opt-in/mihomo.nix | 11 +++-------- darwin/profiles/desktop/home/default.nix | 2 +- darwin/profiles/desktop/packages/fonts.nix | 3 +-- 7 files changed, 13 insertions(+), 34 deletions(-) rename darwin/modules/services/{clash.nix => mihomo.nix} (74%) delete mode 100644 darwin/profiles/common/opt-in/gaming/default.nix delete mode 100644 darwin/profiles/common/opt-in/gaming/home/default.nix diff --git a/darwin/modules/default.nix b/darwin/modules/default.nix index f2041a9..a2818a3 100644 --- a/darwin/modules/default.nix +++ b/darwin/modules/default.nix @@ -1,6 +1,6 @@ {...}: { imports = [ ./networking/proxy.nix - ./services/clash.nix + ./services/mihomo.nix ]; } diff --git a/darwin/modules/services/clash.nix b/darwin/modules/services/mihomo.nix similarity index 74% rename from darwin/modules/services/clash.nix rename to darwin/modules/services/mihomo.nix index f32f3c7..a205e56 100644 --- a/darwin/modules/services/clash.nix +++ b/darwin/modules/services/mihomo.nix @@ -4,13 +4,12 @@ pkgs, ... }: let - cfg = config.services.clash; + cfg = config.services.mihomo; in { - options.services.clash = { - enable = lib.mkEnableOption "Whether to enable Clash, A rule-based proxy in Go."; - package = lib.mkPackageOption pkgs "clash" {}; + options.services.mihomo = { + enable = lib.mkEnableOption "Whether to enable Mihomo, A rule-based proxy in Go."; + package = lib.mkPackageOption pkgs "mihomo" {}; configFile = lib.mkOption { - default = null; type = lib.types.nullOr lib.types.path; description = "Configuration file to use."; }; @@ -20,7 +19,6 @@ in { description = '' Local web interface to use. - You can also use the following website, just in case: - metacubexd: - http://d.metacubex.one - https://metacubex.github.io/metacubexd @@ -41,11 +39,11 @@ in { config = lib.mkIf cfg.enable { ### launchd service # TODO: not run as root user - launchd.daemons."clash" = { + launchd.daemons."mihomo" = { command = builtins.concatStringsSep " " [ (lib.getExe cfg.package) - "-d /etc/clash" - (lib.optionalString (cfg.configFile != null) "-f ${cfg.configFile}") + "-d /etc/mihomo" + cfg.configFile (lib.optionalString (cfg.webui != null) "-ext-ui ${cfg.webui}") (lib.optionalString (cfg.extraOpts != null) cfg.extraOpts) ]; diff --git a/darwin/profiles/common/opt-in/gaming/default.nix b/darwin/profiles/common/opt-in/gaming/default.nix deleted file mode 100644 index fbfae40..0000000 --- a/darwin/profiles/common/opt-in/gaming/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - ### home-manager - home-manager.users.guanranwang = import ./home; - - homebrew.casks = [ - "steam" - ]; -} diff --git a/darwin/profiles/common/opt-in/gaming/home/default.nix b/darwin/profiles/common/opt-in/gaming/home/default.nix deleted file mode 100644 index f27edd8..0000000 --- a/darwin/profiles/common/opt-in/gaming/home/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{...}: { - imports = [ - ../../../../../home/applications/prismlauncher - ]; -} diff --git a/darwin/profiles/common/opt-in/mihomo.nix b/darwin/profiles/common/opt-in/mihomo.nix index e2ed636..49b1086 100644 --- a/darwin/profiles/common/opt-in/mihomo.nix +++ b/darwin/profiles/common/opt-in/mihomo.nix @@ -1,12 +1,7 @@ -{ - pkgs, - config, - ... -}: { - services.clash = { +{pkgs, ...}: { + services.mihomo = { enable = true; - package = pkgs.clash-meta; - webui = config.nur.repos.guanran928.metacubexd; + webui = pkgs.metacubexd; }; ### System proxy settings diff --git a/darwin/profiles/desktop/home/default.nix b/darwin/profiles/desktop/home/default.nix index 22a6c13..612d654 100644 --- a/darwin/profiles/desktop/home/default.nix +++ b/darwin/profiles/desktop/home/default.nix @@ -6,7 +6,7 @@ }: { imports = map (n: ../../../../home/applications/${n}) [ "go" - "mpv" + # "mpv" "nix" ]; diff --git a/darwin/profiles/desktop/packages/fonts.nix b/darwin/profiles/desktop/packages/fonts.nix index b2cde8f..6bedb43 100644 --- a/darwin/profiles/desktop/packages/fonts.nix +++ b/darwin/profiles/desktop/packages/fonts.nix @@ -1,6 +1,5 @@ {pkgs, ...}: { - fonts.fontDir.enable = true; - fonts.fonts = with pkgs; [ + fonts.packages = with pkgs; [ (nerdfonts.override {fonts = ["JetBrainsMono"];}) ]; }