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)
{...}: {
imports = [
../../profiles/core
../../profiles/device-type/desktop
../../profiles/desktop
../../../users/guanranwang/darwin/profiles/core
../../../users/guanranwang/darwin/profiles/device-type/desktop
../../../users/guanranwang/darwin/profiles/opt-in/clash-meta-client.nix
../../../users/guanranwang/darwin/profiles/desktop
../../../users/guanranwang/darwin/profiles/common/opt-in/clash-meta-client.nix
./hardware.configuration.nix
../../hardware/apple/imac/18-3
./hardware-configuration.nix
];
networking.hostName = "Plato";
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, ...}: {
imports = [
../../modules
./nix
./anti-features.nix
./networking.nix
inputs.self.darwinModules.default
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.
#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 = [
../common/core
./packages
];
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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