refactor
This commit is contained in:
+58
-3
@@ -3,10 +3,65 @@
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
mkHost =
|
||||
name: machine:
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
account = config.facts.account;
|
||||
hmStateVersion = machine.hmStateVersion or machine.stateVersion;
|
||||
machineFacts = {
|
||||
displays = { };
|
||||
portable = false;
|
||||
sshKeys = { };
|
||||
syncthingId = null;
|
||||
}
|
||||
// machine
|
||||
// {
|
||||
inherit name hmStateVersion;
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
config.flake.modules.nixos.${name}
|
||||
];
|
||||
|
||||
facts = {
|
||||
inherit (config.facts)
|
||||
account
|
||||
machines
|
||||
services
|
||||
theme
|
||||
;
|
||||
machine = machineFacts;
|
||||
};
|
||||
|
||||
networking.hostName = name;
|
||||
system.stateVersion = machine.stateVersion;
|
||||
|
||||
programs.zsh.enable = true;
|
||||
|
||||
users.users.${account.name} = {
|
||||
isNormalUser = true;
|
||||
home = account.homeDirectory;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
];
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
home-manager.users.${account.name}.home = {
|
||||
username = account.name;
|
||||
homeDirectory = account.homeDirectory;
|
||||
stateVersion = hmStateVersion;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
inputs.flake-parts.flakeModules.modules
|
||||
./data.nix
|
||||
./facts.nix
|
||||
];
|
||||
|
||||
systems = [ "x86_64-linux" ];
|
||||
@@ -15,9 +70,9 @@
|
||||
name: machine:
|
||||
inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ (config.repo.helpers.mkHost name machine) ];
|
||||
modules = [ (mkHost name machine) ];
|
||||
}
|
||||
) config.repo.machines;
|
||||
) config.facts.machines;
|
||||
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
|
||||
Reference in New Issue
Block a user