package.nix (1261B)
1 { 2 fetchpatch, 3 lib, 4 lua5_3, 5 makeWrapper, 6 openssl, 7 stdenv, 8 }: 9 let 10 pname = "certifix"; 11 12 luaossl' = lua5_3.pkgs.luaossl.overrideAttrs (o: { 13 patches = [ 14 (fetchpatch { 15 url = "https://patch-diff.githubusercontent.com/raw/wahern/luaossl/pull/218.patch"; 16 hash = "sha256-CpP3V9MeB7u1pXO96yoMhapluimpTR5Vm5nFFXUM1cw="; # "sha256-2GOliY4/RUzOgx3rqee3X3szCdUVxYDut7d+XFcUTJw="; 17 }) 18 ] ++ lib.optionals (o ? patches) o.patches; 19 }); 20 http = lua5_3.pkgs.http.override { luaossl = luaossl'; }; 21 22 lua = lua5_3.withPackages (ps: [ 23 http 24 ps.luaposix 25 ]); 26 inherit makeWrapper; 27 inherit (lua.pkgs) fennel; 28 in stdenv.mkDerivation { 29 inherit pname; 30 version = "0.1"; 31 32 src = ./.; 33 makeFlags = [ "TARGET=${placeholder "out"}" ]; 34 postInstall = '' 35 lua_path="`lua -e 'print(package.path)'`" 36 lua_cpath="`lua -e 'print(package.cpath)'`" 37 38 makeWrapper ${fennel}/bin/fennel \ 39 $out/bin/${pname} \ 40 --add-flags "--add-fennel-path $out/lib/?.fnl" \ 41 --add-flags "--add-package-path '$out/lib/?.lua$lua_path'" \ 42 --add-flags "--add-package-cpath '$out/lib/?.lua$lua_cpath'" \ 43 --add-flags "$out/lib/main.fnl" 44 ''; 45 buildInputs = [lua fennel]; 46 nativeBuildInputs = [ makeWrapper ]; 47 }