darwin: unbreak

This commit is contained in:
Guanran Wang 2024-07-08 18:10:35 +08:00
parent 432719121e
commit 24bedbe75e
7 changed files with 13 additions and 34 deletions

View file

@ -1,6 +1,6 @@
{...}: { {...}: {
imports = [ imports = [
./networking/proxy.nix ./networking/proxy.nix
./services/clash.nix ./services/mihomo.nix
]; ];
} }

View file

@ -4,13 +4,12 @@
pkgs, pkgs,
... ...
}: let }: let
cfg = config.services.clash; cfg = config.services.mihomo;
in { in {
options.services.clash = { options.services.mihomo = {
enable = lib.mkEnableOption "Whether to enable Clash, A rule-based proxy in Go."; enable = lib.mkEnableOption "Whether to enable Mihomo, A rule-based proxy in Go.";
package = lib.mkPackageOption pkgs "clash" {}; package = lib.mkPackageOption pkgs "mihomo" {};
configFile = lib.mkOption { configFile = lib.mkOption {
default = null;
type = lib.types.nullOr lib.types.path; type = lib.types.nullOr lib.types.path;
description = "Configuration file to use."; description = "Configuration file to use.";
}; };
@ -20,7 +19,6 @@ in {
description = '' description = ''
Local web interface to use. Local web interface to use.
You can also use the following website, just in case:
- metacubexd: - metacubexd:
- http://d.metacubex.one - http://d.metacubex.one
- https://metacubex.github.io/metacubexd - https://metacubex.github.io/metacubexd
@ -41,11 +39,11 @@ in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
### launchd service ### launchd service
# TODO: not run as root user # TODO: not run as root user
launchd.daemons."clash" = { launchd.daemons."mihomo" = {
command = builtins.concatStringsSep " " [ command = builtins.concatStringsSep " " [
(lib.getExe cfg.package) (lib.getExe cfg.package)
"-d /etc/clash" "-d /etc/mihomo"
(lib.optionalString (cfg.configFile != null) "-f ${cfg.configFile}") cfg.configFile
(lib.optionalString (cfg.webui != null) "-ext-ui ${cfg.webui}") (lib.optionalString (cfg.webui != null) "-ext-ui ${cfg.webui}")
(lib.optionalString (cfg.extraOpts != null) cfg.extraOpts) (lib.optionalString (cfg.extraOpts != null) cfg.extraOpts)
]; ];

View file

@ -1,8 +0,0 @@
{
### home-manager
home-manager.users.guanranwang = import ./home;
homebrew.casks = [
"steam"
];
}

View file

@ -1,5 +0,0 @@
{...}: {
imports = [
../../../../../home/applications/prismlauncher
];
}

View file

@ -1,12 +1,7 @@
{ {pkgs, ...}: {
pkgs, services.mihomo = {
config,
...
}: {
services.clash = {
enable = true; enable = true;
package = pkgs.clash-meta; webui = pkgs.metacubexd;
webui = config.nur.repos.guanran928.metacubexd;
}; };
### System proxy settings ### System proxy settings

View file

@ -6,7 +6,7 @@
}: { }: {
imports = map (n: ../../../../home/applications/${n}) [ imports = map (n: ../../../../home/applications/${n}) [
"go" "go"
"mpv" # "mpv"
"nix" "nix"
]; ];

View file

@ -1,6 +1,5 @@
{pkgs, ...}: { {pkgs, ...}: {
fonts.fontDir.enable = true; fonts.packages = with pkgs; [
fonts.fonts = with pkgs; [
(nerdfonts.override {fonts = ["JetBrainsMono"];}) (nerdfonts.override {fonts = ["JetBrainsMono"];})
]; ];
} }