Skip to content

Commit

Permalink
Merge pull request #21 from arnarg/fix/from-yaml
Browse files Browse the repository at this point in the history
Fix implementation of fromYAML
  • Loading branch information
arnarg authored Oct 15, 2024
2 parents 1b6e64e + fc9a71f commit 750f66f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/kube.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{
lib,
klib,
pkgs,
...
}: {
/*
Parses a YAML document string into a list of attribute sets.
> This is re-exported directly from [farcaller/nix-kube-generators](https://github.com/farcaller/nix-kube-generators).
Type:
fromYAML :: String -> [AttrSet]
Expand Down Expand Up @@ -39,7 +37,18 @@
fromYAML =
# String with a yaml document.
yaml:
klib.fromYAML yaml;
lib.pipe yaml [
(yaml: (pkgs.stdenv.mkDerivation {
inherit yaml;
passAsFile = "yaml";
name = "fromYAML";
phases = ["buildPhase"];
buildPhase = "${pkgs.yq}/bin/yq -Ms . $yamlPath > $out";
}))
builtins.readFile
builtins.fromJSON
(builtins.filter (v: v != null))
];

/*
Parse an octal representation of a number and convert into a decimal number. This can be useful when having to represent permission bits in a resource as nix has no support for representing octal numbers.
Expand Down

0 comments on commit 750f66f

Please sign in to comment.