Last active
April 2, 2024 16:18
-
-
Save marcusramberg/f9a63236a4cf124eb7e586e21c7a60eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> { }; | |
with builtins; | |
rec { | |
yaml2nix = path: | |
let | |
jsonOutputDrv = | |
runCommand "from-yaml" { nativeBuildInputs = [ remarshal ]; } | |
''remarshal -if yaml -i "${path}" -of json -o "$out"''; | |
in fromJSON (readFile jsonOutputDrv); | |
run = state: env: | |
let | |
folder = "helm/${state}"; | |
hf = import ../${folder}/helmfile.nix; | |
var = { | |
values = lib.mergeAttrs (yaml2nix ../${folder}/env/defaults.yaml) | |
(yaml2nix ../${folder}/env/${env}.yaml); | |
environment.name = env; | |
}; | |
vals = val: "TODO: fetch ${val} using ${pkgs.vals}"; | |
in hf { inherit lib var vals; }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running it with