2022-09-30 11:47:45 +00:00
|
|
|
{ lib, stdenv, fetchFromSourcehut, luaPackages, lua }:
|
2021-08-05 21:33:18 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "fnlfmt";
|
2024-10-23 06:41:50 +00:00
|
|
|
version = "0.3.2";
|
2021-08-05 21:33:18 +00:00
|
|
|
|
|
|
|
src = fetchFromSourcehut {
|
|
|
|
owner = "~technomancy";
|
2024-10-23 06:41:50 +00:00
|
|
|
repo = "fnlfmt";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
hash = "sha256-LYHhKC8iA4N8DdCH8GfSOkN/e+W3YjkFhVSDQraKoFk=";
|
2021-08-05 21:33:18 +00:00
|
|
|
};
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
nativeBuildInputs = [ luaPackages.fennel ];
|
2021-08-05 21:33:18 +00:00
|
|
|
|
|
|
|
buildInputs = [ lua ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
echo "#!${lua}/bin/lua" > fnlfmt
|
2024-10-23 06:41:50 +00:00
|
|
|
${luaPackages.fennel}/bin/fennel --require-as-include --compile tags/${version}/cli.fnl >> fnlfmt
|
2021-08-05 21:33:18 +00:00
|
|
|
chmod +x fnlfmt
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
install -D ./fnlfmt $out/bin/fnlfmt
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Formatter for Fennel";
|
|
|
|
homepage = "https://git.sr.ht/~technomancy/fnlfmt";
|
|
|
|
license = licenses.lgpl3Plus;
|
|
|
|
platforms = lua.meta.platforms;
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = with maintainers; [ chiroptical ];
|
2023-08-10 07:59:29 +00:00
|
|
|
mainProgram = "fnlfmt";
|
2021-08-05 21:33:18 +00:00
|
|
|
};
|
|
|
|
}
|