Files
nix-config/lib/default.nix
T
imbytecat be247ff3b9 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
2026-04-13 22:25:55 +08:00

85 lines
1.9 KiB
Nix

{ inputs }:
let
inherit (inputs.nixpkgs) lib;
sshKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDRTOo48gzzRGT+bF9dzJCFJu61YgsQVONFtxU9kTPIg"
];
# Shared home-manager configuration block
homeManagerConfig = username: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "bak";
sharedModules = [
inputs.lazyvim.homeManagerModules.default
];
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
sshKeys
;
};
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
sshKeys
;
};
modules = [
../modules/shared
../modules/darwin
inputs.home-manager.darwinModules.home-manager
(homeManagerConfig username)
{ networking.hostName = hostname; }
]
++ extraModules;
};
}