Loading pkgs/build-support/writers/data.nix +6 −22 Original line number Diff line number Diff line { lib, runCommand, dasel }: { lib, pkgs, formats, runCommand, dasel }: let daselBin = lib.getExe dasel; Loading Loading @@ -40,41 +40,25 @@ rec { mkdir -p $out/$(dirname "${nameOrPath}") mv tmp $out/${nameOrPath} ''} ''; ''); # Writes the content to text. # # Example: # writeText "filename.txt" "file content" writeText = makeDataWriter { input = toString; output = "cp $inputPath $out"; }; inherit (pkgs) writeText; # Writes the content to a JSON file. # # Example: # writeJSON "data.json" { hello = "world"; } writeJSON = makeDataWriter { input = builtins.toJSON; output = "${daselBin} -f $inputPath -r json -w json > $out"; }; writeJSON = (pkgs.formats.json {}).generate; # Writes the content to a TOML file. # # Example: # writeTOML "data.toml" { hello = "world"; } writeTOML = makeDataWriter { input = builtins.toJSON; output = "${daselBin} -f $inputPath -r json -w toml > $out"; }; writeTOML = (pkgs.formats.toml {}).generate; # Writes the content to a YAML file. # # Example: # writeYAML "data.yaml" { hello = "world"; } writeYAML = makeDataWriter { input = builtins.toJSON; output = "${daselBin} -f $inputPath -r json -w yaml > $out"; }; writeYAML = (pkgs.formats.yaml {}).generate; } pkgs/build-support/writers/test.nix +3 −1 Original line number Diff line number Diff line Loading @@ -261,7 +261,9 @@ lib.recurseIntoAttrs { toml = expectDataEqual { file = writeTOML "data.toml" { hello = "world"; }; expected = "hello = 'world'\n"; expected = '' hello = "world" ''; }; yaml = expectDataEqual { Loading Loading
pkgs/build-support/writers/data.nix +6 −22 Original line number Diff line number Diff line { lib, runCommand, dasel }: { lib, pkgs, formats, runCommand, dasel }: let daselBin = lib.getExe dasel; Loading Loading @@ -40,41 +40,25 @@ rec { mkdir -p $out/$(dirname "${nameOrPath}") mv tmp $out/${nameOrPath} ''} ''; ''); # Writes the content to text. # # Example: # writeText "filename.txt" "file content" writeText = makeDataWriter { input = toString; output = "cp $inputPath $out"; }; inherit (pkgs) writeText; # Writes the content to a JSON file. # # Example: # writeJSON "data.json" { hello = "world"; } writeJSON = makeDataWriter { input = builtins.toJSON; output = "${daselBin} -f $inputPath -r json -w json > $out"; }; writeJSON = (pkgs.formats.json {}).generate; # Writes the content to a TOML file. # # Example: # writeTOML "data.toml" { hello = "world"; } writeTOML = makeDataWriter { input = builtins.toJSON; output = "${daselBin} -f $inputPath -r json -w toml > $out"; }; writeTOML = (pkgs.formats.toml {}).generate; # Writes the content to a YAML file. # # Example: # writeYAML "data.yaml" { hello = "world"; } writeYAML = makeDataWriter { input = builtins.toJSON; output = "${daselBin} -f $inputPath -r json -w yaml > $out"; }; writeYAML = (pkgs.formats.yaml {}).generate; }
pkgs/build-support/writers/test.nix +3 −1 Original line number Diff line number Diff line Loading @@ -261,7 +261,9 @@ lib.recurseIntoAttrs { toml = expectDataEqual { file = writeTOML "data.toml" { hello = "world"; }; expected = "hello = 'world'\n"; expected = '' hello = "world" ''; }; yaml = expectDataEqual { Loading