refactor names for customs and templates for more clarity. templates are self contained instead of depending on others
This commit is contained in:
parent
ad2092531c
commit
82513c0714
4 changed files with 101 additions and 88 deletions
|
|
@ -3,14 +3,14 @@ let
|
|||
# upstream distro images
|
||||
upstreamImagesJSON = lib.importJSON ./upstream.json;
|
||||
upstreamImages = lib.mapAttrs (name: src: pkgs.fetchurl src) upstreamImagesJSON.${system};
|
||||
customs = (import ./customs.nix) { inherit pkgs lib system commons; };
|
||||
templates = (import ./templates.nix) { inherit pkgs lib system commons upstreamImages customs; };
|
||||
mergeUpstreamImageAndTemplates =
|
||||
name: image:
|
||||
templates = (import ./templates.nix) { inherit pkgs lib system commons; };
|
||||
customs = (import ./customs.nix) { inherit pkgs lib system commons upstreamImages templates; };
|
||||
mergeUpstreamAndCustomImages =
|
||||
name: upstreamImage:
|
||||
let
|
||||
imageTemplates = lib.optionalAttrs (lib.hasAttr "${name}" templates) templates.${name};
|
||||
customImages = lib.optionalAttrs (lib.hasAttr "${name}" customs) customs.${name};
|
||||
in
|
||||
imageTemplates // { upstream = image; };
|
||||
customImages // { upstream = upstreamImage; };
|
||||
|
||||
images = lib.mapAttrs mergeUpstreamImageAndTemplates upstreamImages;
|
||||
in images // { inherit customs; }
|
||||
images = lib.mapAttrs mergeUpstreamAndCustomImages upstreamImages;
|
||||
in images // { inherit templates; }
|
||||
Loading…
Add table
Add a link
Reference in a new issue