Move the yaml functions to their own file.
This commit is contained in:
parent
2c5acd15df
commit
e9a8f78342
24
nix/kubernetes/functions/to_yaml.nix
Normal file
24
nix/kubernetes/functions/to_yaml.nix
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
to_yaml_file =
|
||||||
|
file_name: contents:
|
||||||
|
let
|
||||||
|
settingsFormat = pkgs.formats.yaml { };
|
||||||
|
yaml_file = settingsFormat.generate file_name contents;
|
||||||
|
in
|
||||||
|
yaml_file;
|
||||||
|
to_yaml =
|
||||||
|
file_name: contents:
|
||||||
|
let
|
||||||
|
settingsFormat = pkgs.formats.yaml { };
|
||||||
|
yaml_file = settingsFormat.generate file_name contents;
|
||||||
|
yaml_content = builtins.readFile yaml_file;
|
||||||
|
in
|
||||||
|
yaml_content;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
inherit to_yaml to_yaml_file;
|
||||||
|
}
|
||||||
@ -8,29 +8,13 @@
|
|||||||
# installCheckPhase
|
# installCheckPhase
|
||||||
# distPhase
|
# distPhase
|
||||||
{
|
{
|
||||||
lib,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
stdenv,
|
stdenv,
|
||||||
runCommand,
|
runCommand,
|
||||||
writeText,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
to_yaml_file =
|
to_yaml_file = ((import ../../../functions/to_yaml.nix) {inherit pkgs;}).to_yaml_file;
|
||||||
file_name: contents:
|
|
||||||
let
|
|
||||||
settingsFormat = pkgs.formats.yaml { };
|
|
||||||
yaml_file = settingsFormat.generate file_name contents;
|
|
||||||
in
|
|
||||||
yaml_file;
|
|
||||||
to_yaml =
|
|
||||||
file_name: contents:
|
|
||||||
let
|
|
||||||
settingsFormat = pkgs.formats.yaml { };
|
|
||||||
yaml_file = settingsFormat.generate file_name contents;
|
|
||||||
yaml_content = builtins.readFile yaml_file;
|
|
||||||
in
|
|
||||||
yaml_content;
|
|
||||||
kube_encryption_key = runCommand "kube_encryption_key" { } ''
|
kube_encryption_key = runCommand "kube_encryption_key" { } ''
|
||||||
head -c 32 /dev/urandom | base64 | tee $out
|
head -c 32 /dev/urandom | base64 | tee $out
|
||||||
'';
|
'';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user