refactor
This commit is contained in:
1 parent
81e576a877
commit
cde67e4d75
46 files changed
+619
-518
No files matched your search
+21
-20
@@ -1,6 +1,7 @@
|
||||
{
|
||||
inputs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
@@ -9,17 +10,12 @@ let
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
account = config.facts.account;
|
||||
hmStateVersion = machine.hmStateVersion or machine.stateVersion;
|
||||
machineFacts = {
|
||||
displays = { };
|
||||
portable = false;
|
||||
sshKeys = { };
|
||||
syncthingId = null;
|
||||
}
|
||||
// machine
|
||||
// {
|
||||
inherit name hmStateVersion;
|
||||
machineFacts = machine // {
|
||||
inherit name;
|
||||
};
|
||||
services = lib.mapAttrs (_: service: {
|
||||
inherit (service) scheme domain;
|
||||
}) config.facts.services;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
@@ -29,10 +25,11 @@ let
|
||||
facts = {
|
||||
inherit (config.facts)
|
||||
account
|
||||
externalDevices
|
||||
machines
|
||||
services
|
||||
theme
|
||||
topology
|
||||
;
|
||||
inherit services;
|
||||
machine = machineFacts;
|
||||
};
|
||||
|
||||
@@ -54,7 +51,7 @@ let
|
||||
home-manager.users.${account.name}.home = {
|
||||
username = account.name;
|
||||
homeDirectory = account.homeDirectory;
|
||||
stateVersion = hmStateVersion;
|
||||
stateVersion = machine.hmStateVersion;
|
||||
};
|
||||
};
|
||||
in
|
||||
@@ -66,13 +63,17 @@ in
|
||||
|
||||
systems = [ "x86_64-linux" ];
|
||||
|
||||
flake.nixosConfigurations = builtins.mapAttrs (
|
||||
name: machine:
|
||||
inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ (mkHost name machine) ];
|
||||
}
|
||||
) config.facts.machines;
|
||||
flake.nixosConfigurations =
|
||||
assert lib.assertMsg (builtins.hasAttr config.facts.topology.server.machine config.facts.machines)
|
||||
"facts.topology.server.machine must name an entry in facts.machines";
|
||||
builtins.mapAttrs (
|
||||
name: machine:
|
||||
inputs.nixpkgs.lib.nixosSystem {
|
||||
inherit (machine) system;
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ (mkHost name machine) ];
|
||||
}
|
||||
) config.facts.machines;
|
||||
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
|
||||
Reference in new issue
Block a user