41 lines
981 B
Nix
41 lines
981 B
Nix
{ pkgs, nixpkgs, nixos-unstable, unstable, home-manager, user, ... }:
|
|
|
|
{
|
|
mkHost = { name, users, roles ? [] }:
|
|
let
|
|
system = "x86_64-linux";
|
|
|
|
mkRole = role : import (../roles + "/${role}.nix");
|
|
|
|
users_mod= (map (u: user.mkUser {name = u.user; roles = u.roles; }) users);
|
|
roles_mod = (map (r: mkRole r) roles);
|
|
in nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
|
|
modules = [
|
|
{
|
|
imports = users_mod ++ roles_mod;
|
|
|
|
nixpkgs.pkgs = pkgs;
|
|
nix.nixPath = [
|
|
"nixpkgs=${nixpkgs}"
|
|
"unstable=${nixos-unstable}"
|
|
];
|
|
nix.registry.nixpkgs.flake = nixpkgs;
|
|
nix.registry.unstable.flake = nixos-unstable;
|
|
|
|
users.users.root = {
|
|
shell = pkgs.zsh;
|
|
};
|
|
|
|
home-manager.users.root.imports = [ ../roles/home/common.nix ];
|
|
}
|
|
|
|
home-manager.nixosModules.home-manager
|
|
../roles/common.nix
|
|
../roles/acme.nix
|
|
../hosts/${name}/default.nix
|
|
];
|
|
};
|
|
}
|