From d79a1e15bbc12b9597a5188333aceaab3f45b274 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Tue, 20 Jun 2023 20:19:11 +0100 Subject: [PATCH] get fennel from source instead of luarocks --- pkgs/write-fennel-script/default.nix | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/pkgs/write-fennel-script/default.nix b/pkgs/write-fennel-script/default.nix index 3a7a5cb..60145ab 100644 --- a/pkgs/write-fennel-script/default.nix +++ b/pkgs/write-fennel-script/default.nix @@ -2,20 +2,30 @@ runCommand , luaSmall , runtimeShell +, fetchurl , lib +, lua53Packages }: -let lua = luaSmall; +let inherit (lua53Packages) lua; in name : packages : source : let - luapath = builtins.map (f: "${f}/share/lua/${lua.luaversion}/?.lua;") packages; - luacpath = builtins.map (f: "${f}/lib/lua/${lua.luaversion}/?.so;") packages; - in runCommand name {} '' + fennel = fetchurl { + url = "https://fennel-lang.org/downloads/fennel-1.3.0"; + hash = "sha256-hYSD3rBYF8iTjBOA1m+TvUu8BSp8q6uIMUXi0xwo/dU="; + }; + + luapath = builtins.map (f: "${f}/share/lua/${luaSmall.luaversion}/?.lua;") packages; + luacpath = builtins.map (f: "${f}/lib/lua/${luaSmall.luaversion}/?.so;") packages; + in runCommand name { + nativeBuildInputs = [ lua ]; + } '' + echo $PATH #!${runtimeShell} ( - echo "#!${lua}/bin/lua" + echo "#!${luaSmall}/bin/lua" echo "package.path = ${lib.strings.escapeShellArg luapath} .. package.path" echo "package.cpath = ${lib.strings.escapeShellArg luacpath} .. package.cpath" - ${lua.pkgs.fennel}/bin/fennel --correlate --compile ${source} + lua ${fennel} --correlate --compile ${source} ) > $out chmod a+x $out ''