feat: NixOS 声明式配置(从 Arch + decman 迁移)
- flake.nix: NixOS + home-manager + nixos-wsl 三输入 - hosts/wsl + hosts/bare: WSL 与裸机共享模块,分主机配置 - modules/: base(CLI 工具) + dev(工具链+LSP) + docker + locale + shell - home/: zsh(oh-my-zsh+插件+别名) + git(delta) + starship + 工具集成 - scripts/install.sh: 一键安装脚本(WSL/裸机通用) - 原 bun/go 全局包 hack 改为 nixpkgs 声明式管理
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
{
|
||||
description = "NixOS 声明式系统配置";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
nixos-wsl = {
|
||||
url = "github:nix-community/NixOS-WSL";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
nixos-wsl,
|
||||
home-manager,
|
||||
...
|
||||
}:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
|
||||
# 所有主机共享的模块
|
||||
commonModules = [
|
||||
./modules/base.nix
|
||||
./modules/dev.nix
|
||||
./modules/docker.nix
|
||||
./modules/locale.nix
|
||||
./modules/shell.nix
|
||||
home-manager.nixosModules.home-manager
|
||||
];
|
||||
in
|
||||
{
|
||||
nixosConfigurations = {
|
||||
# WSL 配置
|
||||
wsl = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = commonModules ++ [
|
||||
nixos-wsl.nixosModules.default
|
||||
./hosts/wsl/default.nix
|
||||
];
|
||||
};
|
||||
|
||||
# 裸机配置
|
||||
bare = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = commonModules ++ [
|
||||
./hosts/bare/default.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user