darwin: keep up with nixos

This commit is contained in:
Guanran Wang 2024-01-03 22:41:18 +08:00
parent ab143cf59d
commit 2374223365
No known key found for this signature in database
26 changed files with 32 additions and 77 deletions

View file

@ -1,17 +1,15 @@
# iMac 18,3 (2017) # iMac 18,3 (2017)
{...}: { {...}: {
imports = [ imports = [
../../profiles/core ../../profiles/desktop
../../profiles/device-type/desktop
../../../users/guanranwang/darwin/profiles/core ../../../users/guanranwang/darwin/profiles/desktop
../../../users/guanranwang/darwin/profiles/device-type/desktop ../../../users/guanranwang/darwin/profiles/common/opt-in/clash-meta-client.nix
../../../users/guanranwang/darwin/profiles/opt-in/clash-meta-client.nix
./hardware.configuration.nix ./hardware-configuration.nix
../../hardware/apple/imac/18-3
]; ];
networking.hostName = "Plato"; networking.hostName = "Plato";
time.timeZone = "Asia/Shanghai"; time.timeZone = "Asia/Shanghai";
system.stateVersion = 4;
} }

View file

@ -1,5 +1 @@
{...}: { _: {}
imports = [
./networking
];
}

View file

@ -1,5 +0,0 @@
{...}: {
imports = [
./dns.nix
];
}

View file

@ -1,45 +0,0 @@
{
lib,
config,
...
}: let
cfg = config.myFlake.networking.dns;
in {
options = {
myFlake.networking.dns = {
provider = lib.mkOption {
type = lib.types.enum ["dhcp" "google" "alidns"];
default =
{
"Asia/Shanghai" = "alidns";
}
.${config.time.timeZone}
or "google";
example = "alidns";
description = "Select desired DNS provider.";
};
};
};
config = {
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,9 +1,10 @@
{inputs, ...}: { {inputs, ...}: {
imports = [ imports = [
../../modules
./nix ./nix
./anti-features.nix ./anti-features.nix
./networking.nix
inputs.self.darwinModules.default
inputs.home-manager.darwinModules.home-manager inputs.home-manager.darwinModules.home-manager
]; ];

View file

@ -0,0 +1,9 @@
_: {
networking.dns = [
### AliDNS
"223.5.5.5"
"223.6.6.6"
"2400:3200::1"
"2400:3200:baba::1"
];
}

View file

@ -32,8 +32,4 @@
# Set Git commit hash for darwin-version. # Set Git commit hash for darwin-version.
#system.configurationRevision = self.rev or self.dirtyRev or null; #system.configurationRevision = self.rev or self.dirtyRev or null;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
} }

View file

@ -1,5 +1,6 @@
{...}: { {...}: {
imports = [ imports = [
../common/core
./packages ./packages
]; ];
} }

View file

@ -173,6 +173,7 @@
formatter = eachDefaultSystemMap (system: inputs.nixpkgs.legacyPackages.${system}.alejandra); formatter = eachDefaultSystemMap (system: inputs.nixpkgs.legacyPackages.${system}.alejandra);
packages = eachDefaultSystemMap (system: import ./pkgs inputs.nixpkgs.legacyPackages.${system}); packages = eachDefaultSystemMap (system: import ./pkgs inputs.nixpkgs.legacyPackages.${system});
nixosModules.default = ./nixos/modules; nixosModules.default = ./nixos/modules;
darwinModules.default = ./darwin/modules;
### NixOS ### NixOS
nixosConfigurations = { nixosConfigurations = {

View file

@ -1,8 +1,4 @@
{ {pkgs, ...}: {
pkgs,
lib,
...
}: {
users = { users = {
knownUsers = ["guanranwang"]; knownUsers = ["guanranwang"];
users."guanranwang" = { users."guanranwang" = {
@ -15,6 +11,5 @@
}; };
### Options ### Options
myFlake.networking.dns.provider = lib.mkDefault "alidns";
home-manager.users.guanranwang = import ./home; home-manager.users.guanranwang = import ./home;
} }

View file

@ -1,6 +1,6 @@
{...}: { {...}: {
imports = [ imports = [
../../../../home-manager ../../../../../home-manager
]; ];
# https://github.com/mathiasbynens/dotfiles/blob/main/.macos # https://github.com/mathiasbynens/dotfiles/blob/main/.macos

View file

@ -1,4 +1,7 @@
_: { _: {
imports = [
../common/core
];
### home-manager ### home-manager
home-manager.users.guanranwang = import ./home; home-manager.users.guanranwang = import ./home;
} }

View file

@ -4,7 +4,7 @@
lib, lib,
... ...
}: { }: {
imports = map (n: ../../../../../home-manager/applications/${n}) [ imports = map (n: ../../../../home-manager/applications/${n}) [
# Terminal # Terminal
"alacritty" "alacritty"

View file

@ -1,11 +1,16 @@
{config, ...}: { {
config,
lib,
pkgs,
...
}: {
programs.gpg = { programs.gpg = {
enable = true; enable = true;
homedir = "${config.xdg.dataHome}/gnupg"; homedir = "${config.xdg.dataHome}/gnupg";
}; };
services.gpg-agent = { services.gpg-agent = {
enable = true; enable = lib.mkIf (!pkgs.stdenv.hostPlatform.isDarwin) true;
pinentryFlavor = "gnome3"; pinentryFlavor = "gnome3";
}; };
} }