diff --git a/flake.nix b/flake.nix index 00b29c0..719ccd1 100644 --- a/flake.nix +++ b/flake.nix @@ -49,6 +49,7 @@ version = "0.0.1"; releases = with pkgs.lib; attrsets.collect isDerivation releases; src = ./.; + buildInputs = [ pkgs.kustomize ]; phases = ["installPhase"]; installPhase = builtins.readFile ./lib/output.sh; }; diff --git a/lib/output.sh b/lib/output.sh index a97fdb7..7647567 100644 --- a/lib/output.sh +++ b/lib/output.sh @@ -18,15 +18,23 @@ do target=$(tr / - <<< "$path") for drv in $releases; do - if grep -Eq "$target" <<< "$drv"; then - ln -s "$drv" "$dir" + if grep -qE "$target" <<< "$drv"; then + pushd "$dir" > /dev/null || exit 1 + cp "$drv" ./RELEASE.yaml for file in \ $(find "$src/releases/$path" -type f -name "*.yaml" \ | grep -v "values.yaml$") do - ln -s "$file" "$dir" + cp "$file" . done + + kustomize create + # shellcheck disable=SC2035 + # Can't use "./", otherwise the kustomization is added to itself. + kustomize edit add resource *.yaml + + popd > /dev/null || exit 1 fi done fi