use more common naming scheme
This commit is contained in:
parent
a0cfdffbdc
commit
d3688f5426
3 changed files with 10 additions and 10 deletions
16
lib.nix
16
lib.nix
|
@ -11,7 +11,7 @@ rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
# make a template with placeholders
|
# make a template with placeholders
|
||||||
template_text = { name, text, outPath }:
|
templateText = { name, text, outPath }:
|
||||||
pkgs.runCommand name {
|
pkgs.runCommand name {
|
||||||
textBeforeTemplate = text;
|
textBeforeTemplate = text;
|
||||||
script = ''
|
script = ''
|
||||||
|
@ -26,15 +26,15 @@ rec {
|
||||||
chmod +x $out/bin/${name}
|
chmod +x $out/bin/${name}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
template_generator = generator: { name, value, outPath }: template_text {
|
templateGenerator = generator: { name, value, outPath }: templateText {
|
||||||
inherit name outPath;
|
inherit name outPath;
|
||||||
text = generator value;
|
text = generator value;
|
||||||
};
|
};
|
||||||
|
|
||||||
template_json = options: template_generator (lib.generators.toJSON options);
|
templateJsonWith = options: templateGenerator (lib.generators.toJSON options);
|
||||||
template_yaml = options: template_generator (lib.generators.toYAML options); # just json
|
templateYamlWith = options: templateGenerator (lib.generators.toYAML options); # just json
|
||||||
template_ini = options: template_generator (lib.generators.toINI options);
|
templateIniWith = options: templateGenerator (lib.generators.toINI options);
|
||||||
template_json' = template_json { };
|
templateJson = templateJsonWith { };
|
||||||
template_yaml' = template_yaml { };
|
templateYaml = templateYamlWith { };
|
||||||
template_ini' = template_ini { };
|
templateIni = templateIniWith { };
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ in (nixpkgs.lib.nixos.runTest {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStartPre = "${legacyPackages.${system}.template_json {} {
|
ExecStartPre = "${legacyPackages.${system}.templateJson {
|
||||||
name = "test";
|
name = "test";
|
||||||
value = {
|
value = {
|
||||||
foo = "text";
|
foo = "text";
|
||||||
|
|
|
@ -14,7 +14,7 @@ in (nixpkgs.lib.nixos.runTest {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStartPre = "${legacyPackages.${system}.template_text {
|
ExecStartPre = "${legacyPackages.${system}.templateText {
|
||||||
name = "test";
|
name = "test";
|
||||||
text = ''
|
text = ''
|
||||||
public text
|
public text
|
||||||
|
|
Loading…
Add table
Reference in a new issue