Files
nix-config/lib/default.nix
T
imbytecat 68184abd8f refactor: 重构为三设备架构,zsh 迁移至 fish
- 新增 darwinConfigurations: mac-mini, macbook-air (aarch64-darwin)
- WSL 统一用户名为 imbytecat,主机名改为 awesome-* 系列
- zsh 全面迁移至 fish (abbrs, 内置补全/高亮, zoxide --cmd cd)
- 激活 nix-darwin 模块: Homebrew, 系统偏好, Touch ID sudo
- 移除 bare/standalone 配置及 catppuccin nixosModule from mkDarwin
2026-04-10 21:48:19 +08:00

86 lines
2.0 KiB
Nix

{ inputs }:
let
inherit (inputs.nixpkgs) lib;
# Shared home-manager configuration block
homeManagerConfig = username: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit inputs username;
};
users.${username} = import ../home;
};
};
in
{
# ── NixOS host builder ──────────────────────────────
mkNixos =
{
hostname,
system,
username,
extraModules ? [ ],
}:
lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs hostname username;
};
modules =
[
../modules/shared
../modules/nixos
inputs.home-manager.nixosModules.home-manager
inputs.catppuccin.nixosModules.catppuccin
(homeManagerConfig username)
{ networking.hostName = hostname; }
]
++ extraModules;
};
# ── nix-darwin host builder ─────────────────────────
mkDarwin =
{
hostname,
system,
username,
extraModules ? [ ],
}:
inputs.nix-darwin.lib.darwinSystem {
inherit system;
specialArgs = {
inherit inputs hostname username;
};
modules =
[
../modules/shared
../modules/darwin
inputs.home-manager.darwinModules.home-manager
(homeManagerConfig username)
{ networking.hostName = hostname; }
]
++ extraModules;
};
# ── Standalone Home Manager (no NixOS / no Darwin) ──
mkHome =
{
system,
username,
}:
inputs.home-manager.lib.homeManagerConfiguration {
pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
};
extraSpecialArgs = {
inherit inputs username;
hostname = "standalone";
};
modules = [ ../home ];
};
}