darwin: keep up with nixos

This commit is contained in:
Guanran Wang 2023-12-13 19:02:11 +08:00
parent a401ea4bf9
commit 99117c1f6d
No known key found for this signature in database
9 changed files with 61 additions and 57 deletions

View file

@ -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 ???
};
}

View file

@ -8,8 +8,13 @@ in {
options = { options = {
myFlake.darwin.networking.dns = { myFlake.darwin.networking.dns = {
provider = lib.mkOption { provider = lib.mkOption {
type = lib.types.enum ["google" "alidns"]; type = lib.types.enum ["dhcp" "google" "alidns"];
default = "google"; default =
{
"Asia/Shanghai" = "alidns";
}
.${config.time.timeZone}
or "google";
example = "alidns"; example = "alidns";
description = "Select desired DNS provider."; description = "Select desired DNS provider.";
}; };
@ -17,21 +22,24 @@ in {
}; };
config = { config = {
networking.dns = lib.mkMerge [ networking.dns =
(lib.mkIf (cfg.provider == "google") [ {
### Google DNS dhcp = [];
"8.8.8.8" google = [
"8.8.4.4" ### Google DNS
"2001:4860:4860::8888" "8.8.8.8"
"2001:4860:4860::8844" "8.8.4.4"
]) "2001:4860:4860::8888"
(lib.mkIf (cfg.provider == "alidns") [ "2001:4860:4860::8844"
### AliDNS ];
"223.5.5.5" alidns = [
"223.6.6.6" ### AliDNS
"2400:3200::1" "223.5.5.5"
"2400:3200:baba::1" "223.6.6.6"
]) "2400:3200::1"
]; "2400:3200:baba::1"
];
}
.${cfg.provider};
}; };
} }

View file

@ -1,7 +1,15 @@
{...}: { {inputs, ...}: {
imports = [ imports = [
../../modules ../../modules
./nix ./nix
./anti-features.nix
inputs.home-manager.darwinModules.home-manager
]; ];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {inherit inputs;}; # ??? isnt specialArgs imported by default ???
};
} }

View file

@ -1,4 +1,17 @@
_: { {
inputs,
pkgs,
...
}: {
# Enable Flakes # Enable Flakes
nix.settings.experimental-features = ["nix-command" "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];
} }

View file

@ -3,6 +3,5 @@
./core.nix ./core.nix
./fonts.nix ./fonts.nix
./homebrew.nix ./homebrew.nix
./unfree.nix
]; ];
} }

View file

@ -1,32 +1,12 @@
_: { _: {
homebrew = { homebrew = {
enable = true; enable = true;
brews = [
"fastfetch" # fastfetch is broken in nixpkgs
];
casks = [ casks = [
#"alacritty"
#"android-platform-tools"
#"yesplaymusic"
#"vscodium"
"alt-tab"
"altserver" "altserver"
"balenaetcher"
#"clashx"
"opencore-patcher"
"squirrel" "squirrel"
#"element"
"telegram" "telegram"
"librewolf" "librewolf"
"google-chrome" "google-chrome"
"activate" # koekeishiya/formulae
];
taps = [
"b3z/small" # activate
]; ];
}; };
} }

View file

@ -1,4 +1,8 @@
{pkgs, ...}: { {
pkgs,
lib,
...
}: {
programs.mpv = { programs.mpv = {
enable = true; enable = true;
config = { config = {
@ -7,10 +11,11 @@
profile = "gpu-hq"; profile = "gpu-hq";
osc = "no"; osc = "no";
}; };
scripts = with pkgs.mpvScripts; [ scripts = with pkgs.mpvScripts;
mpris [
thumbfast thumbfast
]; ]
++ lib.optionals (!pkgs.stdenv.hostPlatform.isDarwin) (with pkgs.mpvScripts; [mpris]);
}; };
# for scripts that is not in nixpkgs # for scripts that is not in nixpkgs

View file

@ -41,7 +41,7 @@
./applications/hyperfine ./applications/hyperfine
./applications/ydict ./applications/ydict
./applications/fastfetch #./applications/fastfetch # broken on x86_64-darwin, https://github.com/NixOS/nixpkgs/issues/273947
./applications/android-tools ./applications/android-tools
./applications/tealdeer ./applications/tealdeer
]; ];