config: fix images export

This commit is contained in:
Gabriel Arazas 2023-08-04 10:25:05 +08:00
parent e9ff0dc7fa
commit f60d28ba2a
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -394,31 +394,32 @@
images = images =
forAllSystems (system: forAllSystems (system:
let let
images' = lib'.filterAttrs (host: metadata: lib'.elem system metadata.systems) images; images' = lib'.filterAttrs (host: metadata: system == metadata._system) images;
in in
lib'.mapAttrs lib'.mapAttrs'
(host: metadata: (host: metadata:
let let
inherit system; inherit system;
name = metadata._name;
nixpkgs-channel = metadata.nixpkgs-channel or "nixpkgs"; nixpkgs-channel = metadata.nixpkgs-channel or "nixpkgs";
pkgs = import inputs."${nixpkgs-channel}" { inherit system overlays; }; pkgs = import inputs."${nixpkgs-channel}" { inherit system overlays; };
format = metadata.format or "iso"; format = metadata.format or "iso";
in in
mkImage { lib'.nameValuePair name (mkImage {
inherit format system pkgs extraArgs; inherit format system pkgs extraArgs;
extraModules = [ extraModules = [
({ lib, ... }: { ({ lib, ... }: {
config = lib.mkMerge [ config = lib.mkMerge [
{ networking.hostName = lib.mkForce metadata.hostname or host; } { networking.hostName = lib.mkForce metadata.hostname or name; }
(lib.mkIf (metadata ? domain) (lib.mkIf (metadata ? domain)
{ networking.domain = lib.mkForce metadata.domain; }) { networking.domain = lib.mkForce metadata.domain; })
]; ];
}) })
hostSharedConfig hostSharedConfig
./hosts/${host} ./hosts/${name}
]; ];
}) }))
images'); images');
# My several development shells for usual type of projects. This is much # My several development shells for usual type of projects. This is much