Skip to content

Instantly share code, notes, and snippets.

@sevanspowell
Last active October 13, 2022 01:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sevanspowell/d4110d471e85bc1bfd8fb0f41eddb5b1 to your computer and use it in GitHub Desktop.
Save sevanspowell/d4110d471e85bc1bfd8fb0f41eddb5b1 to your computer and use it in GitHub Desktop.
Agda NixOS Hacky Setup - Put these in appropriate dirs, cd to plfa dir and nix-shell, launch emacs from there. Thanks Brian McKenna and Isaac Elliot.
{
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "eabe7b845f867e696f8a11be04d47520b3ff4660",
"sha256": "068qbrp2fvpn437hwg932hm0pav2m10sj7v0kcj3wp8hsvsv088w"
}
{ compiler ? "default" }:
self: super:
let
hsPkgs = if compiler == "default"
then super.haskellPackages
else super.haskell.packages.${compiler};
hsPkgSources = {
agda2html = self.pkgs.fetchFromGitHub {
owner = "wenkokke";
repo = "agda2html";
sha256 = "08a6cw9kghylgynqmdfkwf2ggmkd21d6i4f67188138mss38aik6";
rev = "0aece4fb509c3333f2d271789e0a09729ad08754";
};
};
hsPkgsOverlay = hself: hsuper: {
agda2html = hself.callCabal2nix "agda2html" "${hsPkgSources.agda2html}" {};
};
in
{
haskellPackages = hsPkgs.override (oldArgs: {
overrides =
self.lib.composeExtensions
(oldArgs.overrides or (_: _: {}))
(hsPkgsOverlay);
});
}
{ }:
let
inherit (import <nixpkgs> {}) fetchFromGitHub;
pin-info = builtins.fromJSON (builtins.readFile ./nixpkgs.json);
pin-source = fetchFromGitHub {
inherit (pin-info) owner repo rev sha256;
};
pkgs = import pin-source { overlays = [ (import ./overlay.nix {}) ]; };
drv = pkgs.agda.mkDerivation(self: {
name = "plfa";
src = pkgs.lib.sourceFilesBySuffices ./. [ ".agda" ".lagda" ".agda-lib" "libraries" ];
pathsToLink = [ "/share" "/bin" ];
buildDepends = [
pkgs.ruby
pkgs.haskellPackages.Agda
pkgs.haskellPackages.agda2html
pkgs.AgdaStdlib
pkgs.bundler
];
});
in
if pkgs.lib.inNixShell then drv.env else drv
name: standard-library
include: /nix/store/sq1ap8xg0ymk9czdd9q87lhvvbixf34x-agda-stdlib-1.0/share/agda
-- Use your own path to agda-stdlib in nix store ^
plfa
standard-library
<PATH TO plfa HERE>/plfa.github.io/plfa.agda-lib
<PATH TO plfa HERE>/plfa.github.io/standard-library.agda-lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment