use more common naming scheme
This commit is contained in:
parent
aa58480b33
commit
3410c97729
3 changed files with 10 additions and 10 deletions
16
lib.nix
16
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 { };
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue