diff --git a/lib.nix b/lib.nix index 4d23c26..8dee784 100644 --- a/lib.nix +++ b/lib.nix @@ -11,7 +11,7 @@ rec { }; # make a template with placeholders - template_text = { name, text, outPath }: + templateText = { name, text, outPath }: pkgs.runCommand name { textBeforeTemplate = text; script = '' @@ -26,15 +26,15 @@ rec { chmod +x $out/bin/${name} ''; - template_generator = generator: { name, value, outPath }: template_text { + templateGenerator = generator: { name, value, outPath }: templateText { inherit name outPath; text = generator value; }; - template_json = options: template_generator (lib.generators.toJSON options); - template_yaml = options: template_generator (lib.generators.toYAML options); # just json - template_ini = options: template_generator (lib.generators.toINI options); - template_json' = template_json { }; - template_yaml' = template_yaml { }; - template_ini' = template_ini { }; + templateJsonWith = options: templateGenerator (lib.generators.toJSON options); + templateYamlWith = options: templateGenerator (lib.generators.toYAML options); # just json + templateIniWith = options: templateGenerator (lib.generators.toINI options); + templateJson = templateJsonWith { }; + templateYaml = templateYamlWith { }; + templateIni = templateIniWith { }; } diff --git a/tests/json.nix b/tests/json.nix index fd780fd..0c5eeed 100644 --- a/tests/json.nix +++ b/tests/json.nix @@ -12,7 +12,7 @@ in (nixpkgs.lib.nixos.runTest { wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "oneshot"; - ExecStartPre = "${legacyPackages.${system}.template_json {} { + ExecStartPre = "${legacyPackages.${system}.templateJson { name = "test"; value = { foo = "text"; diff --git a/tests/template.nix b/tests/template.nix index 5382807..1182428 100644 --- a/tests/template.nix +++ b/tests/template.nix @@ -14,7 +14,7 @@ in (nixpkgs.lib.nixos.runTest { wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "oneshot"; - ExecStartPre = "${legacyPackages.${system}.template_text { + ExecStartPre = "${legacyPackages.${system}.templateText { name = "test"; text = '' public text