mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-09-20 03:18:00 +03:00
09526c8555
* Spelling and typo fixes in doc and code comments * Trailing whitespace or whitespace only truncation * readTheDocs formatting corrections
30 lines
574 B
Nix
30 lines
574 B
Nix
{ stdenv, writeScript, coreutils, gawk, nix
|
|
, nix-tools
|
|
, limitMB ? 525
|
|
}:
|
|
|
|
with stdenv.lib;
|
|
|
|
writeScript "check-closure-size.sh" ''
|
|
#!${stdenv.shell}
|
|
|
|
set -euo pipefail
|
|
|
|
export PATH="${makeBinPath [ coreutils gawk nix ]}"
|
|
|
|
get_closure_size() {
|
|
du -scm $(nix-store -qR $1) | sort -n | tail -n25
|
|
}
|
|
|
|
nt="$(get_closure_size ${nix-tools})"
|
|
echo ' ${nix-tools}'
|
|
echo "$nt"
|
|
|
|
total=$(awk '$2 == "total" { print $1; }' <<< "$nt")
|
|
|
|
if [ $total -gt ${toString limitMB} ]; then
|
|
echo "Closure size exceeds limit of ${toString limitMB}MB!"
|
|
exit 1
|
|
fi
|
|
''
|