config: revise file retrieval for NixOS and home-manager configs

This commit is contained in:
Gabriel Arazas 2023-08-03 22:58:55 +08:00
parent 1a74104845
commit 21e157d328
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -307,14 +307,13 @@
images' = listImagesWithSystems images; images' = listImagesWithSystems images;
in in
lib'.mapAttrs lib'.mapAttrs
(_: host: (filename: host:
let let
name = host._name; path = ./hosts/${filename};
path = ./hosts/${name};
extraModules = [ extraModules = [
({ lib, ... }: { ({ lib, ... }: {
config = lib.mkMerge [ config = lib.mkMerge [
{ networking.hostName = lib.mkForce name; } { networking.hostName = lib.mkForce host._name; }
(lib.mkIf (host ? domain) (lib.mkIf (host ? domain)
{ networking.domain = lib.mkForce host.domain; }) { networking.domain = lib.mkForce host.domain; })
@ -344,14 +343,14 @@
users' = listImagesWithSystems users; users' = listImagesWithSystems users;
in in
lib'.mapAttrs lib'.mapAttrs
(name: metadata: (filename: metadata:
let let
name = metadata._name; name = metadata._name;
system = metadata._system; system = metadata._system;
pkgs = import inputs."${metadata.nixpkgs-channel or "nixpkgs"}" { pkgs = import inputs."${metadata.nixpkgs-channel or "nixpkgs"}" {
inherit system overlays; inherit system overlays;
}; };
path = ./users/home-manager/${name}; path = ./users/home-manager/${filename};
extraModules = [ extraModules = [
({ pkgs, config, ... }: { ({ pkgs, config, ... }: {
# To be able to use the most of our config as possible, we want # To be able to use the most of our config as possible, we want