darwin: unbreak

This commit is contained in:
Guanran Wang 2024-07-08 18:10:35 +08:00
parent d86e047588
commit a31c38d2e5
Signed by: nyancat
GPG key ID: 91F97D9ED12639CF
9 changed files with 13 additions and 65 deletions

View file

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

View file

@ -4,30 +4,24 @@
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" {};
configFile = lib.mkOption {
default = null;
type = lib.types.nullOr lib.types.path;
description = "Configuration file to use.";
};
options.services.mihomo = {
enable = lib.mkEnableOption "Whether to enable Mihomo, A rule-based proxy in Go.";
package = lib.mkPackageOption pkgs "mihomo" {};
webui = lib.mkOption {
default = null;
type = lib.types.nullOr lib.types.path;
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
- https://metacubexd.pages.dev
- yacd:
- https://yacd.haishan.me
- clash-dashboard (buggy):
- clash-dashboard:
- https://clash.razord.top
'';
};
@ -41,11 +35,10 @@ 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"
(lib.optionalString (cfg.webui != null) "-ext-ui ${cfg.webui}")
(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,
config,
...
}: {
services.clash = {
{pkgs, ...}: {
services.mihomo = {
enable = true;
package = pkgs.clash-meta;
webui = config.nur.repos.guanran928.metacubexd;
webui = pkgs.metacubexd;
};
### System proxy settings

View file

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

View file

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

View file

@ -322,26 +322,6 @@
"type": "github"
}
},
"nixcasks": {
"inputs": {
"nixpkgs": [
"nixpkgs-stable"
]
},
"locked": {
"lastModified": 1720301939,
"narHash": "sha256-yP2+IPhcUscJbwbuAaHQRAIKrrnF1ePQBwwzGFlfqmE=",
"owner": "jacekszymanski",
"repo": "nixcasks",
"rev": "b3ebbbc306d051edb9bc2fa9dc791dabfd3d106b",
"type": "github"
},
"original": {
"owner": "jacekszymanski",
"repo": "nixcasks",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1719895800,
@ -503,7 +483,6 @@
"nix-darwin": "nix-darwin",
"nix-formatter-pack": "nix-formatter-pack",
"nix-on-droid": "nix-on-droid",
"nixcasks": "nixcasks",
"nixos-hardware": "nixos-hardware",
"nixos-sensible": "nixos-sensible",
"nixpkgs": "nixpkgs",

View file

@ -66,11 +66,6 @@
inputs.nix-formatter-pack.follows = "nix-formatter-pack";
inputs.nmd.follows = "nmd";
};
nixcasks = {
# contains unfree
url = "github:jacekszymanski/nixcasks";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
nur = {
url = "github:nix-community/NUR";
};