Created
July 6, 2020 15:52
-
-
Save kwannoel/c9225e802fbc9879df96d2307ac6e34c to your computer and use it in GitHub Desktop.
Nix shell for agda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from @ryanorendorff's gist: https://gist.github.com/ryanorendorff/f5c96d9f363a0e390425c2d9588bbb9d | |
{ pkgs ? import <nixos> {} }: | |
let | |
# The standard library in nixpkgs does not come with a *.agda-lib file, so we | |
# generate it here. | |
standard-library-agda-lib = pkgs.writeText "standard-library.agda-lib" '' | |
name: standard-library | |
include: ${pkgs.AgdaStdlib}/share/agda | |
''; | |
# Agda uses the AGDA_DIR environmental variable to determine where to load | |
# default libraries from. This should have a few files in it, including the | |
# "defaults" and "libraries" files generated below. | |
# | |
# More information (and possibilities!) are detailed here: | |
# https://agda.readthedocs.io/en/v2.6.0.1/tools/package-system.html | |
agdaDir = pkgs.stdenv.mkDerivation { | |
name = "agdaDir"; | |
phases = [ "installPhase" ]; | |
# If you want to add more libraries simply list more in the $out/libraries | |
# and $out/defaults folder. | |
installPhase = '' | |
mkdir $out | |
echo "${standard-library-agda-lib}" >> $out/libraries | |
echo "standard-library" >> $out/defaults | |
''; | |
}; | |
agdaGhc = pkgs.haskellPackages.ghcWithPackages ( | |
haskellPackages: [ pkgs.haskellPackages.ieee ] | |
); | |
in | |
pkgs.mkShell { | |
name = "agda-with-stdlib"; | |
buildInputs = [ pkgs.haskellPackages.Agda | |
agdaGhc | |
]; | |
AGDA_DIR = agdaDir; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment