73 lines
1.5 KiB
Nix
73 lines
1.5 KiB
Nix
{ lib, config, ... }:
|
|
let
|
|
nixosModules = config.flake.modules.nixos;
|
|
hmModules = config.flake.modules.homeManager;
|
|
|
|
mkHost =
|
|
machine:
|
|
{ config, pkgs, ... }:
|
|
{
|
|
imports = [
|
|
nixosModules.host-base
|
|
nixosModules.meta
|
|
machine.module
|
|
];
|
|
meta.machine = machine;
|
|
|
|
networking.hostName = machine.name;
|
|
system.stateVersion = machine.stateVersion;
|
|
|
|
# TODO: Move this
|
|
programs.zsh.enable = true;
|
|
|
|
users.users = lib.mapAttrs (
|
|
_: account: {
|
|
inherit (account) name extraGroups;
|
|
isNormalUser = true;
|
|
home = account.homeDirectory;
|
|
# TODO: Move this
|
|
shell = pkgs.zsh;
|
|
}
|
|
);
|
|
|
|
home-manager.users = lib.mapAttrs (
|
|
_: account: {
|
|
imports = [
|
|
hmModules.meta
|
|
account.baseModule
|
|
];
|
|
meta = {
|
|
inherit machine account;
|
|
};
|
|
home.homeDirectory = account.homeDirectory;
|
|
home.stateVersion = machine.hmStateVersion;
|
|
}
|
|
);
|
|
};
|
|
|
|
mkWorkstationHost =
|
|
machine:
|
|
{ ... }:
|
|
{
|
|
imports = [
|
|
(mkHost machine)
|
|
nixosModules.workstation-base
|
|
];
|
|
|
|
home-manager.users = lib.mapAttrs (
|
|
_: account: {
|
|
imports = [ account.workstationModule ];
|
|
}
|
|
);
|
|
};
|
|
in
|
|
{
|
|
options.repo.helpers = lib.mkOption {
|
|
type = lib.types.attrsOf lib.types.raw;
|
|
internal = true;
|
|
readOnly = true;
|
|
};
|
|
|
|
config.repo.helpers = { inherit mkHost mkWorkstationHost; };
|
|
}
|