@@ -4,7 +4,32 @@
4, cmake, libyaml, Security
4, cmake, libyaml, Security
5, libjpeg, libX11, libXext, libXft, libXinerama
5, libjpeg, libX11, libXext, libXft, libXinerama
6, extraLibraries ? [ jdk unixODBC libXpm libSM libXt freetype fontconfig ]
6, extraLibraries ? [ jdk unixODBC libXpm libSM libXt freetype fontconfig ]
7−, extraPacks ? []
7+# Packs must be installed from a local directory during the build, with dependencies
8+# resolved manually, e.g. to install the 'julian' pack, which depends on the 'delay', 'list_util' and 'typedef' packs:
9+# julian = pkgs.fetchzip {
10+# name = "swipl-pack-julian";
11+# url = "https://github.com/mndrix/julian/archive/v0.1.3.zip";
12+# sha256 = "1sgql7c21p3c5m14kwa0bcmlwn9fql612krn9h36gla1j9yjdfgy";
14+# delay = pkgs.fetchzip {
15+# name = "swipl-pack-delay";
16+# url = "https://github.com/mndrix/delay/archive/v0.3.3.zip";
17+# sha256 = "0ira87afxnc2dnbbmgwmrr8qvary8lhzvhqwd52dccm6yqd3nybg";
19+# list_util = pkgs.fetchzip {
20+# name = "swipl-pack-list_util";
21+# url = "https://github.com/mndrix/list_util/archive/v0.13.0.zip";
22+# sha256 = "0lx7vffflak0y8l8vg8k0g8qddwwn23ksbz02hi3f8rbarh1n89q";
24+# typedef = builtins.fetchTarball {
25+# name = "swipl-pack-typedef";
26+# url = "https://raw.githubusercontent.com/samer--/prolog/master/typedef/release/typedef-0.1.9.tgz";
27+# sha256 = "056nqjn01g18fb1b2qivv9s7hb4azk24nx2d4kvkbmm1k91f44p3";
29+# swiProlog = pkgs.swiProlog.override { extraPacks = map (dep-path: "'file://${dep-path}'") [
30+# julian delay list_util typedef
8, withGui ? false
33, withGui ? false
@@ -26,6 +51,11 @@ stdenv.mkDerivation {
26 fetchSubmodules = true;
51 fetchSubmodules = true;
54+ # Add the packInstall path to the swipl pack search path
56+ echo "user:file_search_path(pack, '$out/lib/swipl/pack')." >> /build/$sourceRoot/boot/init.pl
29 nativeBuildInputs = [ cmake pkg-config ];
59 nativeBuildInputs = [ cmake pkg-config ];
31 buildInputs = [ gmp readline openssl
61 buildInputs = [ gmp readline openssl
@@ -39,6 +69,10 @@ stdenv.mkDerivation {
40 cmakeFlags = [ "-DSWIPL_INSTALL_IN_LIB=ON" ];
70 cmakeFlags = [ "-DSWIPL_INSTALL_IN_LIB=ON" ];
73+ mkdir -p $out/lib/swipl/pack
42 postInstall = builtins.concatStringsSep "\n"
76 postInstall = builtins.concatStringsSep "\n"
43 ( builtins.map (packInstall "$out") extraPacks
77 ( builtins.map (packInstall "$out") extraPacks