|
1 | 1 | {withEmacs ? false, |
2 | 2 | nixpkgs ? (fetchTarball { |
3 | | - url = "https://github.com/CohenCyril/nixpkgs/archive/7f59c094a0e5c8659856e611075fe88d6177830f.tar.gz"; |
4 | | - sha256 = "00cf4r8dqfx2hwlwaqb239h72m4s0wl97i98424xd4hki0vzifbi"; |
| 3 | + url = "https://github.com/CohenCyril/nixpkgs/archive/8d04d29adb547353ed9fb5c5c4aa6d540e198366.tar.gz"; |
| 4 | + sha256 = "1v4l37xkadpnkydpycnk9hrjgh6yc792k66yi7f6203zzr0phzx8"; |
5 | 5 | }), |
6 | 6 | coq-version ? "8.11", |
7 | 7 | print-env ? false |
8 | 8 | }: |
9 | | -with import nixpkgs {}; |
10 | | -let |
11 | | - pgEmacs = emacsWithPackages (epkgs: |
12 | | - with epkgs.melpaStablePackages; [proof-general]); |
13 | | - myCoqPackages = { |
14 | | - "8.10" = coqPackages_8_10; |
15 | | - "8.11" = coqPackages_8_11; |
16 | | - }."${coq-version}"; |
17 | | - coq = myCoqPackages.coq; |
18 | | - coq-elpi = myCoqPackages.coq-elpi.overrideAttrs(o: { |
19 | | - name = "coq8.11-elpi-v1.4.0"; |
20 | | - src = fetchTarball https://github.com/LPCIC/coq-elpi/archive/v1.4.0.tar.gz; |
21 | | - }); |
22 | | -in |
23 | | -stdenv.mkDerivation { |
| 9 | +with import nixpkgs { |
| 10 | + overlays = [ (super: self: { |
| 11 | + coqPackages = { "8.11" = super.coqPackages_8_11; }."${coq-version}"; |
| 12 | + coq = self.coqPackages.coq; |
| 13 | + })]; |
| 14 | +}; |
| 15 | +let pgEmacs = emacsWithPackages (epkgs: with epkgs.melpaStablePackages; [proof-general]); in |
| 16 | +coqPackages.hierarchy-builder.overrideAttrs (old: { |
24 | 17 | name = "coq${coq.coq-version}-hierarchy-builder-dev"; |
25 | | - |
26 | 18 | src = ./.; |
27 | | - |
28 | | - nativeBuildInputs = [ which ]; |
29 | | - buildInputs = [ coq coq.ocaml coq.ocamlPackages.elpi coq-elpi ]; |
30 | | - |
31 | | - installPhase = ''make -f Makefile.coq VFILES=structures.v COQLIB=$out/lib/coq/${coq.coq-version}/ install''; |
32 | | - |
33 | | - meta = { |
34 | | - description = "Coq plugin embedding ELPI."; |
35 | | - maintainers = [ stdenv.lib.maintainers.cohencyril ]; |
36 | | - license = stdenv.lib.licenses.lgpl21; |
37 | | - inherit (coq.meta) platforms; |
38 | | - inherit (src.meta) homepage; |
39 | | - }; |
40 | | - |
41 | | - passthru = { |
42 | | - compatibleCoqVersions = stdenv.lib.flip builtins.hasAttr params; |
43 | | - }; |
| 19 | + buildInputs = old.buildInputs ++ |
| 20 | + (if lib.trivial.inNixShell then lib.optional withEmacs pgEmacs |
| 21 | + else []); |
44 | 22 | } |
| 23 | +// (if lib.trivial.inNixShell then { |
| 24 | + shellHook = '' |
| 25 | + nixEnv (){ |
| 26 | + echo "Here is your work environement:" |
| 27 | + for x in $buildInputs; do printf " "; echo $x | cut -d "-" -f "2-"; done |
| 28 | + echo "you can pass option '--argstr coq-version \"x.y\"' to nix-shell to change coq versions" |
| 29 | + } |
| 30 | + '' + lib.optionalString print-env "nixEnv"; |
| 31 | +} else {})) |
0 commit comments