refactor: KISS cleanup — deduplicate shared config, merge thin files
- Extract fonts, fish.enable, openssh.enable to modules/shared/ - Centralize sshKeys in lib/ via specialArgs - Merge nixos/base.nix + locale.nix into nixos/default.nix - Merge home/theme.nix into home/default.nix - Simplify homeManagerConfig, flake packages output - Remove redundant vim/wget from NixOS system packages - Update AGENTS.md to reflect new structure
This commit is contained in:
@@ -1,35 +1,26 @@
|
||||
{ pkgs, username, ... }:
|
||||
{
|
||||
pkgs,
|
||||
username,
|
||||
sshKeys,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
# ── Primary user (required by nix-darwin) ──────────
|
||||
system.primaryUser = username;
|
||||
|
||||
# ── Shell ──────────────────────────────────────────
|
||||
programs.fish.enable = true;
|
||||
|
||||
# ── 1Password CLI ───────────────────────────────────
|
||||
programs._1password.enable = true;
|
||||
|
||||
# ── SSH ───────────────────────────────────────────
|
||||
services.openssh.enable = true;
|
||||
|
||||
# ── User ───────────────────────────────────────────
|
||||
users.knownUsers = [ username ];
|
||||
users.users.${username} = {
|
||||
home = "/Users/${username}";
|
||||
shell = pkgs.fish;
|
||||
uid = 501;
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDRTOo48gzzRGT+bF9dzJCFJu61YgsQVONFtxU9kTPIg"
|
||||
];
|
||||
openssh.authorizedKeys.keys = sshKeys;
|
||||
};
|
||||
|
||||
# ── Fonts ──────────────────────────────────────────
|
||||
fonts.packages = with pkgs; [
|
||||
maple-mono.NF-CN-unhinted
|
||||
nerd-fonts.symbols-only
|
||||
];
|
||||
|
||||
# ── macOS system preferences ───────────────────────
|
||||
system.defaults = {
|
||||
LaunchServices.LSQuarantine = false;
|
||||
@@ -65,7 +56,7 @@
|
||||
];
|
||||
|
||||
brews = [
|
||||
"mole" # broken in nixpkgs
|
||||
"mole"
|
||||
];
|
||||
|
||||
# GUI apps
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
# ── System-essential packages ──────────────────────
|
||||
# User-level tools live in home-manager (home/)
|
||||
environment.systemPackages = with pkgs; [
|
||||
curl
|
||||
git
|
||||
ghostty.terminfo
|
||||
vim
|
||||
wget
|
||||
];
|
||||
|
||||
# ── Fonts ──────────────────────────────────────────
|
||||
fonts.packages = with pkgs; [
|
||||
maple-mono.NF-CN-unhinted
|
||||
nerd-fonts.symbols-only
|
||||
];
|
||||
}
|
||||
+19
-10
@@ -1,26 +1,35 @@
|
||||
{ pkgs, username, ... }:
|
||||
{
|
||||
pkgs,
|
||||
username,
|
||||
sshKeys,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./base.nix
|
||||
./docker.nix
|
||||
./locale.nix
|
||||
];
|
||||
|
||||
# ── Default shell ──────────────────────────────────
|
||||
programs.fish.enable = true;
|
||||
# ── System-essential packages ──────────────────────
|
||||
environment.systemPackages = with pkgs; [
|
||||
curl
|
||||
git
|
||||
ghostty.terminfo
|
||||
];
|
||||
|
||||
# ── SSH ──────────────────────────────────────────
|
||||
services.openssh.enable = true;
|
||||
# ── Locale / Timezone ──────────────────────────────
|
||||
i18n = {
|
||||
defaultLocale = "en_US.UTF-8";
|
||||
supportedLocales = [ "en_US.UTF-8/UTF-8" ];
|
||||
};
|
||||
time.timeZone = "Asia/Shanghai";
|
||||
|
||||
# ── Default user ───────────────────────────────────
|
||||
users.users.${username} = {
|
||||
isNormalUser = true;
|
||||
shell = pkgs.fish;
|
||||
extraGroups = [ "wheel" ];
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDRTOo48gzzRGT+bF9dzJCFJu61YgsQVONFtxU9kTPIg"
|
||||
];
|
||||
openssh.authorizedKeys.keys = sshKeys;
|
||||
};
|
||||
|
||||
# ── sudo ───────────────────────────────────────────
|
||||
|
||||
@@ -8,8 +8,4 @@
|
||||
environment.systemPackages = with pkgs; [
|
||||
docker-compose
|
||||
];
|
||||
|
||||
# WSL 环境下如使用 Docker Desktop,可改为:
|
||||
# wsl.docker-desktop.enable = true;
|
||||
# 并将上面的 virtualisation.docker.enable 设为 false
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
i18n = {
|
||||
defaultLocale = "en_US.UTF-8";
|
||||
supportedLocales = [ "en_US.UTF-8/UTF-8" ];
|
||||
};
|
||||
|
||||
time.timeZone = "Asia/Shanghai";
|
||||
}
|
||||
@@ -1,3 +1,9 @@
|
||||
{
|
||||
imports = [ ./nix.nix ];
|
||||
imports = [
|
||||
./fonts.nix
|
||||
./nix.nix
|
||||
];
|
||||
|
||||
programs.fish.enable = true;
|
||||
services.openssh.enable = true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
fonts.packages = with pkgs; [
|
||||
maple-mono.NF-CN-unhinted
|
||||
nerd-fonts.symbols-only
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user