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 = {
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};
};
}

View file

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

View file

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

View file

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

View file

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

View file

@ -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

View file

@ -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
];