refactor: schema
This commit is contained in:
+16
-13
@@ -37,26 +37,35 @@ let
|
||||
};
|
||||
|
||||
mkHost =
|
||||
machine:
|
||||
name: machine:
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
account = config.repo.account;
|
||||
accountHome = account.homeDirectory or "/home/${account.name}";
|
||||
normalizedMachine = machine // {
|
||||
inherit name;
|
||||
displays = machine.displays or { };
|
||||
hmStateVersion = machine.hmStateVersion or machine.stateVersion;
|
||||
portable = machine.portable or false;
|
||||
sshKeys = machine.sshKeys or { };
|
||||
syncthingId = machine.syncthingId or null;
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
nixosModules.${machine.name}
|
||||
nixosModules.${name}
|
||||
];
|
||||
|
||||
meta.machine = machine;
|
||||
facts.machine = normalizedMachine;
|
||||
|
||||
networking.hostName = machine.name;
|
||||
networking.hostName = name;
|
||||
system.stateVersion = machine.stateVersion;
|
||||
|
||||
programs.zsh.enable = true;
|
||||
|
||||
users.users.${account.name} = {
|
||||
isNormalUser = true;
|
||||
home = account.homeDirectory;
|
||||
home = accountHome;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
@@ -67,19 +76,13 @@ let
|
||||
home-manager.users.${account.name} = {
|
||||
home = {
|
||||
username = account.name;
|
||||
homeDirectory = account.homeDirectory;
|
||||
stateVersion = machine.hmStateVersion;
|
||||
homeDirectory = accountHome;
|
||||
stateVersion = normalizedMachine.hmStateVersion;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.repo.helpers = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.raw;
|
||||
internal = true;
|
||||
readOnly = true;
|
||||
};
|
||||
|
||||
config.repo.helpers = {
|
||||
inherit
|
||||
mkCaddyReverseProxy
|
||||
|
||||
Reference in New Issue
Block a user