diff --git a/darwin/flake-modules/home-manager.nix b/darwin/flake-modules/home-manager.nix deleted file mode 100644 index 5fc9f94..0000000 --- a/darwin/flake-modules/home-manager.nix +++ /dev/null @@ -1,9 +0,0 @@ -{inputs, ...}: { - imports = [inputs.home-manager.darwinModules.home-manager]; - - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - extraSpecialArgs = {inherit inputs;}; # ??? isnt specialArgs imported by default ??? - }; -} diff --git a/darwin/modules/networking/dns.nix b/darwin/modules/networking/dns.nix index da21b8a..b9936bd 100644 --- a/darwin/modules/networking/dns.nix +++ b/darwin/modules/networking/dns.nix @@ -8,8 +8,13 @@ in { options = { myFlake.darwin.networking.dns = { provider = lib.mkOption { - type = lib.types.enum ["google" "alidns"]; - default = "google"; + type = lib.types.enum ["dhcp" "google" "alidns"]; + default = + { + "Asia/Shanghai" = "alidns"; + } + .${config.time.timeZone} + or "google"; example = "alidns"; description = "Select desired DNS provider."; }; @@ -17,21 +22,24 @@ in { }; config = { - networking.dns = lib.mkMerge [ - (lib.mkIf (cfg.provider == "google") [ - ### Google DNS - "8.8.8.8" - "8.8.4.4" - "2001:4860:4860::8888" - "2001:4860:4860::8844" - ]) - (lib.mkIf (cfg.provider == "alidns") [ - ### AliDNS - "223.5.5.5" - "223.6.6.6" - "2400:3200::1" - "2400:3200:baba::1" - ]) - ]; + networking.dns = + { + dhcp = []; + google = [ + ### Google DNS + "8.8.8.8" + "8.8.4.4" + "2001:4860:4860::8888" + "2001:4860:4860::8844" + ]; + alidns = [ + ### AliDNS + "223.5.5.5" + "223.6.6.6" + "2400:3200::1" + "2400:3200:baba::1" + ]; + } + .${cfg.provider}; }; } diff --git a/darwin/profiles/device-type/desktop/packages/unfree.nix b/darwin/profiles/core/anti-features.nix similarity index 100% rename from darwin/profiles/device-type/desktop/packages/unfree.nix rename to darwin/profiles/core/anti-features.nix diff --git a/darwin/profiles/core/default.nix b/darwin/profiles/core/default.nix index 72849b1..730ae57 100644 --- a/darwin/profiles/core/default.nix +++ b/darwin/profiles/core/default.nix @@ -1,7 +1,15 @@ -{...}: { +{inputs, ...}: { imports = [ ../../modules - ./nix + ./anti-features.nix + + inputs.home-manager.darwinModules.home-manager ]; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = {inherit inputs;}; # ??? isnt specialArgs imported by default ??? + }; } diff --git a/darwin/profiles/core/nix/flake.nix b/darwin/profiles/core/nix/flake.nix index 39c65cb..cb4e472 100755 --- a/darwin/profiles/core/nix/flake.nix +++ b/darwin/profiles/core/nix/flake.nix @@ -1,4 +1,17 @@ -_: { +{ + inputs, + pkgs, + ... +}: { # Enable Flakes nix.settings.experimental-features = ["nix-command" "flakes"]; + + # Disable flake-registry + # https://nixos-and-flakes.thiscute.world/best-practices/nix-path-and-flake-registry + nix.settings.flake-registry = ""; + nix.registry.nixpkgs.flake = inputs.nixpkgs; + nix.registry.nixpkgs-stable.flake = inputs.nixpkgs-stable; + + # Install Git + environment.systemPackages = [pkgs.git]; } diff --git a/darwin/profiles/device-type/desktop/packages/default.nix b/darwin/profiles/device-type/desktop/packages/default.nix index 470830e..c234462 100644 --- a/darwin/profiles/device-type/desktop/packages/default.nix +++ b/darwin/profiles/device-type/desktop/packages/default.nix @@ -3,6 +3,5 @@ ./core.nix ./fonts.nix ./homebrew.nix - ./unfree.nix ]; } diff --git a/darwin/profiles/device-type/desktop/packages/homebrew.nix b/darwin/profiles/device-type/desktop/packages/homebrew.nix index ef85b01..b1bfc8e 100644 --- a/darwin/profiles/device-type/desktop/packages/homebrew.nix +++ b/darwin/profiles/device-type/desktop/packages/homebrew.nix @@ -1,32 +1,12 @@ _: { homebrew = { enable = true; - brews = [ - "fastfetch" # fastfetch is broken in nixpkgs - ]; casks = [ - #"alacritty" - #"android-platform-tools" - #"yesplaymusic" - #"vscodium" - - "alt-tab" "altserver" - "balenaetcher" - #"clashx" - "opencore-patcher" "squirrel" - - #"element" "telegram" - "librewolf" "google-chrome" - - "activate" # koekeishiya/formulae - ]; - taps = [ - "b3z/small" # activate ]; }; } diff --git a/users/guanranwang/home-manager/applications/mpv/default.nix b/users/guanranwang/home-manager/applications/mpv/default.nix index fde3d19..1f03c07 100644 --- a/users/guanranwang/home-manager/applications/mpv/default.nix +++ b/users/guanranwang/home-manager/applications/mpv/default.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: { +{ + pkgs, + lib, + ... +}: { programs.mpv = { enable = true; config = { @@ -7,10 +11,11 @@ profile = "gpu-hq"; osc = "no"; }; - scripts = with pkgs.mpvScripts; [ - mpris - thumbfast - ]; + scripts = with pkgs.mpvScripts; + [ + thumbfast + ] + ++ lib.optionals (!pkgs.stdenv.hostPlatform.isDarwin) (with pkgs.mpvScripts; [mpris]); }; # for scripts that is not in nixpkgs diff --git a/users/guanranwang/home-manager/default.nix b/users/guanranwang/home-manager/default.nix index 105797a..7593a89 100644 --- a/users/guanranwang/home-manager/default.nix +++ b/users/guanranwang/home-manager/default.nix @@ -41,7 +41,7 @@ ./applications/hyperfine ./applications/ydict - ./applications/fastfetch + #./applications/fastfetch # broken on x86_64-darwin, https://github.com/NixOS/nixpkgs/issues/273947 ./applications/android-tools ./applications/tealdeer ];