From 3410c977291508cf759c773d0c43595adc07e2b5 Mon Sep 17 00:00:00 2001 From: cinereal Date: Thu, 19 Jun 2025 10:10:57 +0200 Subject: [PATCH] use more common naming scheme --- lib.nix | 16 ++++++++-------- tests/json.nix | 2 +- tests/template.nix | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib.nix b/lib.nix index 8e7e1c9..9bf4642 100644 --- a/lib.nix +++ b/lib.nix @@ -7,7 +7,7 @@ rec { }; # make a template with placeholders - template_text = { name, text, outPath }: + templateText = { name, text, outPath }: pkgs.runCommand name { textBeforeTemplate = text; script = '' @@ -22,15 +22,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