Skip to content

Commit 828737a

Browse files
committed
merging and shortening default.nix and shell.nix
1 parent d399d64 commit 828737a

File tree

2 files changed

+22
-71
lines changed

2 files changed

+22
-71
lines changed

default.nix

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,31 @@
11
{withEmacs ? false,
22
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";
55
}),
66
coq-version ? "8.11",
77
print-env ? false
88
}:
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: {
2417
name = "coq${coq.coq-version}-hierarchy-builder-dev";
25-
2618
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 []);
4422
}
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 {}))

shell.nix

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)