2022-10-13 18:05:31 +01:00
|
|
|
{ pkgs, nixpkgs, nixos-unstable, unstable, home-manager, user, system, ... }:
|
2021-10-06 18:17:06 +01:00
|
|
|
|
|
|
|
{
|
2022-10-13 17:08:08 +01:00
|
|
|
mkHost = { name, users, roles ? [ ], imports ? [ ] }:
|
|
|
|
let
|
|
|
|
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);
|
|
|
|
add_imports = imports;
|
|
|
|
in nixpkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
|
|
|
|
|
|
|
modules = [
|
|
|
|
{
|
|
|
|
imports = users_mod ++ roles_mod ++ add_imports;
|
|
|
|
nixpkgs = { inherit 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 ];
|
|
|
|
extraSpecialArgs.unstable = unstable;
|
|
|
|
useGlobalPkgs = true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
home-manager.nixosModules.home-manager
|
|
|
|
../roles/common.nix
|
|
|
|
../roles/acme.nix
|
|
|
|
../hosts/${name}/default.nix
|
|
|
|
];
|
|
|
|
};
|
2021-10-06 18:17:06 +01:00
|
|
|
}
|