mirror of
https://git.sr.ht/~goorzhel/turboprop
synced 2024-12-14 11:37:37 +00:00
Rid self of flotsam in flake-builders
I'll rethink `paths`.
This commit is contained in:
parent
6bbd867da3
commit
b92b4400bb
1 changed files with 0 additions and 49 deletions
|
@ -9,19 +9,7 @@
|
|||
}: let
|
||||
mapAttrs = builtins.mapAttrs;
|
||||
in {
|
||||
services = serviceData: clusterData:
|
||||
mapAttrs
|
||||
(namespace: services:
|
||||
mapAttrs
|
||||
(name: module: {
|
||||
})
|
||||
services)
|
||||
serviceData;
|
||||
|
||||
serviceLoader = {
|
||||
self,
|
||||
super,
|
||||
root,
|
||||
inputs, # {charts, lib, pkgs, user, kubeVersion, apiVersions}
|
||||
...
|
||||
}: p: let
|
||||
|
@ -50,41 +38,4 @@ in {
|
|||
}
|
||||
else null;
|
||||
};
|
||||
|
||||
# Transforms an attrset of built service trees keyed by root directory:
|
||||
# {services = {./00-istio = {istio-system = {...}; ...}; ./01-kyverno = ...};}
|
||||
# into a list of strings mapping target paths to derivations:
|
||||
# ["services/00-istio/istio-system/istiod-.../SERVICE.yaml:$derivation_path" ... ]
|
||||
# I have no idea how I'm going to walk future-me through this function,
|
||||
# but here's an attempt:
|
||||
paths = trees:
|
||||
with builtins;
|
||||
with pkgs.lib;
|
||||
lists.flatten
|
||||
(attrValues
|
||||
# I key `trees` by root dir (e.g.: "services") because the service trees
|
||||
# don't know the name of their own root. But the output needs to be a list,
|
||||
# so I lop the `services =` part off with `attrValues`.
|
||||
(mapAttrs
|
||||
(
|
||||
root: tree:
|
||||
# root=="services"; tree=={svc={breezewiki={...};};
|
||||
attrsets.mapAttrsToList
|
||||
(
|
||||
namespace: names:
|
||||
# (attrNames names)==["breezewiki" ...];
|
||||
map
|
||||
(name: let
|
||||
servicePath = "${root}/${namespace}/${name}";
|
||||
service = getAttr name (getAttr namespace tree);
|
||||
pathPair = ["${servicePath}/SERVICE.yaml:${service.out.outPath}"];
|
||||
in
|
||||
if service.extra != null
|
||||
then [pathPair "${servicePath}/EXTRA.yaml:${service.extra.outPath}"]
|
||||
else [pathPair])
|
||||
(attrNames names)
|
||||
)
|
||||
tree
|
||||
)
|
||||
trees));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue