mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-04 05:50:00 +00:00
Made with
```shell
git restore .
fd '\.nix$' pkgs/ --type f -j1 -x bash -xc "$(cat <<"EOF"
typos --no-check-filenames --write-changes "$1"
git diff --exit-code "$1" && exit
#( git diff "$1" | grep -qE "^\+ +[^# ]") && git restore "$1"
count1="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> ' | wc -l )"
count2="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> (<span style="color:#f8f8f2;"> *</span>)?<span style="color:#75715e;">.*</span>$' | wc -l )"
[[ $count1 -ne $count2 ]] && git restore "$1"
EOF
)" -- {}
```
and filtered with `GIT_DIFF_OPTS='--unified=15' git -c interactive.singleKey=true add --patch`
I initially tried using the tree-sitter cli, python bindings and even ast-grep through various means, but this is what I ended up with.
44 lines
1.4 KiB
Nix
44 lines
1.4 KiB
Nix
{
|
|
lib,
|
|
coq,
|
|
mkCoqPackages,
|
|
runCommand,
|
|
}:
|
|
|
|
let
|
|
|
|
# This is just coq, but with dontFilter set to true. We need to set
|
|
# dontFilter to true here so that _all_ packages are visible in coqPackages.
|
|
# There may be some versions of the top-level coq and coqPackages that don't
|
|
# build QuickChick, which is what we are using for this test below.
|
|
coqWithAllPackages = coq // {
|
|
dontFilter = true;
|
|
};
|
|
|
|
coqPackages = mkCoqPackages coqWithAllPackages;
|
|
|
|
# This is the main test. This uses overrideCoqDerivation to
|
|
# override arguments to mkCoqDerivation.
|
|
#
|
|
# Here, we override the defaultVersion and release arguments to
|
|
# mkCoqDerivation.
|
|
overriddenQuickChick = coqPackages.lib.overrideCoqDerivation {
|
|
defaultVersion = "9999";
|
|
release."9999".sha256 = lib.fakeSha256;
|
|
} coqPackages.QuickChick;
|
|
in
|
|
|
|
runCommand "coq-overrideCoqDerivation-test-0.1"
|
|
{ meta.maintainers = with lib.maintainers; [ cdepillabout ]; }
|
|
''
|
|
# Confirm that the computed version number for the overridden QuickChick does
|
|
# actually become 9999, as set above.
|
|
if [ "${overriddenQuickChick.version}" -eq "9999" ]; then
|
|
echo "overriddenQuickChick version was successfully set to 9999"
|
|
touch $out
|
|
else
|
|
echo "ERROR: overriddenQuickChick version was supposed to be 9999, but was actually: ${overriddenQuickChick.version}"
|
|
exit 1
|
|
fi
|
|
''
|