blog/nix/agda-bin.nix

24 lines
587 B
Nix
Raw Normal View History

2024-06-27 00:17:01 +00:00
{ agda-pkg, runCommand, writeShellScriptBin, writeTextFile, agdaPackages }:
2024-06-26 23:18:25 +00:00
2024-06-27 00:17:01 +00:00
let
libraryFile =
with agdaPackages;
writeTextFile {
name = "agda-libraries";
text = ''
${agdaPackages.cubical}/cubical.agda-lib
${agdaPackages.standard-library}/standard-library.agda-lib
'';
};
# Add an extra layer of indirection here to prevent all of GHC from being pulled in
wtf = runCommand "agda-bin" { } ''
cp ${agda-pkg}/bin/agda $out
'';
in
writeShellScriptBin "agda" ''
set -euo pipefail
exec ${wtf} --library-file=${libraryFile} $@
''