cleanup whitespace and commas
* [] is now [ ] * {} is now { } * commas in arglists go at end of line not beginning In short, I ran the whole thing through nixfmt-rfc-style but only accepted about 30% of its changes. I might grow accustomed to more of it over time
This commit is contained in:
@@ -1,38 +1,38 @@
|
||||
{
|
||||
lua
|
||||
, lib
|
||||
, fennel
|
||||
, stdenv
|
||||
lua,
|
||||
lib,
|
||||
fennel,
|
||||
stdenv,
|
||||
}:
|
||||
name :
|
||||
name:
|
||||
{
|
||||
packages ? [],
|
||||
packages ? [ ],
|
||||
correlate ? false,
|
||||
mainFunction ? null
|
||||
} : source :
|
||||
let
|
||||
luapath = builtins.map
|
||||
(f:
|
||||
"${f}/share/lua/${lua.luaversion}/?.lua;" +
|
||||
"${f}/share/lua/${lua.luaversion}/?/init.lua;")
|
||||
packages;
|
||||
luacpath = builtins.map (f: "${f}/lib/lua/${lua.luaversion}/?.so;") packages;
|
||||
luaFlags = lib.optionalString (mainFunction !=null) "-e dofile(arg[0]).${mainFunction}()";
|
||||
in stdenv.mkDerivation {
|
||||
inherit name;
|
||||
src = ./.;
|
||||
nativeBuildInputs = [ fennel ];
|
||||
buildPhase = ''
|
||||
(
|
||||
echo "#!${lua}/bin/lua ${luaFlags}"
|
||||
echo "package.path = ${lib.strings.escapeShellArg (builtins.concatStringsSep "" luapath)} .. package.path"
|
||||
echo "package.cpath = ${lib.strings.escapeShellArg (builtins.concatStringsSep "" luacpath)} .. package.cpath"
|
||||
echo "local ok, stdlib = pcall(require,'posix.stdlib'); if ok then stdlib.setenv('PATH',${lib.escapeShellArg (lib.makeBinPath packages)} .. \":\" .. os.getenv('PATH')) end"
|
||||
fennel ${if correlate then "--correlate" else ""} --compile ${source}
|
||||
) > ${name}.lua
|
||||
'';
|
||||
installPhase = ''
|
||||
cp ${name}.lua $out
|
||||
chmod +x $out
|
||||
'';
|
||||
}
|
||||
mainFunction ? null,
|
||||
}:
|
||||
source:
|
||||
let
|
||||
luapath = builtins.map (
|
||||
f: "${f}/share/lua/${lua.luaversion}/?.lua;" + "${f}/share/lua/${lua.luaversion}/?/init.lua;"
|
||||
) packages;
|
||||
luacpath = builtins.map (f: "${f}/lib/lua/${lua.luaversion}/?.so;") packages;
|
||||
luaFlags = lib.optionalString (mainFunction != null) "-e dofile(arg[0]).${mainFunction}()";
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
inherit name;
|
||||
src = ./.;
|
||||
nativeBuildInputs = [ fennel ];
|
||||
buildPhase = ''
|
||||
(
|
||||
echo "#!${lua}/bin/lua ${luaFlags}"
|
||||
echo "package.path = ${lib.strings.escapeShellArg (builtins.concatStringsSep "" luapath)} .. package.path"
|
||||
echo "package.cpath = ${lib.strings.escapeShellArg (builtins.concatStringsSep "" luacpath)} .. package.cpath"
|
||||
echo "local ok, stdlib = pcall(require,'posix.stdlib'); if ok then stdlib.setenv('PATH',${lib.escapeShellArg (lib.makeBinPath packages)} .. \":\" .. os.getenv('PATH')) end"
|
||||
fennel ${if correlate then "--correlate" else ""} --compile ${source}
|
||||
) > ${name}.lua
|
||||
'';
|
||||
installPhase = ''
|
||||
cp ${name}.lua $out
|
||||
chmod +x $out
|
||||
'';
|
||||
}
|
||||
|
Reference in New Issue
Block a user