23 lines
767 B
Nix
23 lines
767 B
Nix
# 这个文件提供了一个通用函数,用于创建nixosSystem
|
||
{
|
||
# 创建nixosSystem的通用函数
|
||
# 这个函数只负责创建nixosSystem,不处理nixpkgs的选择
|
||
# args: 从flake.nix传递的所有参数
|
||
# profile: 要使用的nixpkgs (由profile的default.nix决定)
|
||
# path: profile目录的路径
|
||
mkNixosSystem = { args, nixpkgs, path }:
|
||
let
|
||
# 获取profile名称(目录名)
|
||
profile = builtins.baseNameOf path;
|
||
specialArgs = args // { hostname = profile; }; # 添加hostname
|
||
in
|
||
nixpkgs.lib.nixosSystem {
|
||
system = "x86_64-linux";
|
||
inherit specialArgs;
|
||
modules = [
|
||
# 导入configuration.nix模块,其中包含了实际的配置
|
||
"${path}/configuration.nix"
|
||
];
|
||
};
|
||
}
|