flake.nix 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. {
  2. description = "Agda is a dependently typed programming language / interactive theorem prover.";
  3. inputs.flake-utils.url = "github:numtide/flake-utils";
  4. outputs = { self, nixpkgs, flake-utils }: (flake-utils.lib.eachDefaultSystem (system: {
  5. packages = let
  6. pkgs = import nixpkgs { inherit system; overlays = [ self.overlay ]; };
  7. in {
  8. inherit (pkgs.haskellPackages) Agda;
  9. # TODO agda2-mode
  10. };
  11. defaultPackage = self.packages.${system}.Agda;
  12. })) // {
  13. overlay = final: prev: {
  14. haskellPackages = prev.haskellPackages.override {
  15. overrides = self.haskellOverlay;
  16. };
  17. };
  18. haskellOverlay = final: prev: let
  19. inherit (final) callCabal2nixWithOptions;
  20. shortRev = builtins.substring 0 9 self.rev;
  21. postfix = if self ? revCount then "${toString self.revCount}_${shortRev}" else "Dirty";
  22. in {
  23. # TODO use separate evaluation system?
  24. Agda = callCabal2nixWithOptions "Agda" ./. "--flag enable-cluster-counting --flag optimise-heavily" ({
  25. mkDerivation = args: final.mkDerivation (args // {
  26. version = "${args.version}-pre${postfix}";
  27. postInstall = "$out/bin/agda-mode compile";
  28. # TODO Make check phase work
  29. # At least requires:
  30. # Setting AGDA_BIN (or using the Makefile, which at least requires cabal-install)
  31. # Making agda-stdlib available (or disabling the relevant tests somehow)
  32. doCheck = false;
  33. });
  34. });
  35. };
  36. };
  37. }