Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions checks/cleanCargoTomlTests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
filters,
lib,
linkFarmFromDrvs,
remarshal,
runCommand,
writeTOML,
}:
Expand All @@ -22,11 +21,7 @@ let
if lib.pathExists expectedPathSpecific then expectedPathSpecific else path + "/expected.toml";
in
runCommand "compare-${folderName}-${filterName}" { } ''
function reformat {
${remarshal}/bin/remarshal --sort-keys -i "$1" --of toml
}

diff <(reformat ${expected}) <(reformat ${cleanedToml})
diff ${expected} ${cleanedToml}
touch $out
'';
cmpAllFilters =
Expand Down
10 changes: 0 additions & 10 deletions checks/mkDummySrcTests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
lib,
linkFarmFromDrvs,
mkDummySrc,
remarshal,
runCommand,
writeText,
}:
Expand All @@ -18,15 +17,6 @@ let
in
runCommand "compare-${name}" { } ''
echo ${expected} ${actual}
cp -r --no-preserve=ownership,mode ${expected} ./expected
cp -r --no-preserve=ownership,mode ${actual} ./actual

find ./expected ./actual \
-name Cargo.toml \
-exec mv '{}' '{}.bak' \; \
-exec ${remarshal}/bin/remarshal --sort-keys --if toml -i '{}.bak' --of toml -o '{}' \;
find ./expected ./actual -name Cargo.toml.bak -delete

diff -r ./expected ./actual
touch $out
'';
Expand Down
6 changes: 3 additions & 3 deletions lib/writeTOML.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

let
inherit (pkgsBuildBuild)
remarshal
yj
runCommand
;
in
Expand All @@ -13,8 +13,8 @@ runCommand name
{
contents = builtins.toJSON contents;
passAsFile = [ "contents" ];
nativeBuildInputs = [ remarshal ];
nativeBuildInputs = [ yj ];
}
''
remarshal -i $contentsPath -if json -of toml -o $out
cat $contentsPath | yj -jt > $out
''