feat(packages): add fennel and fennel-ls

Built using `dream2nix`, based on my (reo101) forks of both projects
This commit is contained in:
reo101 2024-09-15 14:49:10 +03:00
parent ee8d85a568
commit b35e6362a0
Signed by: reo101
GPG key ID: 675AA7EF13964ACB
2 changed files with 120 additions and 0 deletions

View file

@ -0,0 +1,55 @@
{ config
, lib
, dream2nix
, ...
}: {
imports = [
dream2nix.modules.dream2nix.mkDerivation
];
deps = { nixpkgs, ... }: {
# Fetchers
inherit (nixpkgs)
fetchFromGitHub
;
# Build inputs
lua = nixpkgs.luajit;
fennel = config.deps.lua.pkgs.fennel;
};
name = "fennel-ls";
version = "0.1.2-dev";
mkDerivation = {
src = config.deps.fetchFromGitHub {
owner = "reo101";
repo = config.name;
rev = "3099ba016b346696b8600dfbdffd9a66704f83f9";
hash = "sha256-H5znjiYuQEbNG2WyTvH1CbnSk5PzaoPNg+xc+y66Gq0=";
};
makeFlags = [
"PREFIX=$(out)"
"LUA=${lib.getExe' config.deps.lua "lua"}"
"FENNEL=${lib.getExe' config.deps.fennel "fennel"}"
"EXE=${config.mkDerivation.meta.mainProgram}"
];
nativeBuildInputs = with config.deps; [
];
buildInputs = with config.deps; [
# NOTE: `lua` and `fennel` provisioned using their corresponding `makeFlags`
];
meta = with lib; {
description = "A language server for intelligent editing of the Fennel Programming Language";
homepage = "https://github.com/reo101/fennel-ls";
license = licenses.mit;
maintainers = with maintainers; [ reo101 ];
inherit (config.deps.lua.meta) platforms;
mainProgram = "fennel-ls";
};
};
}

65
pkgs/fennel/default.nix Normal file
View file

@ -0,0 +1,65 @@
{ config
, lib
, dream2nix
, ...
}: {
imports = [
dream2nix.modules.dream2nix.mkDerivation
];
deps = { nixpkgs, ... }: {
# Fetchers
inherit (nixpkgs)
fetchFromGitHub
;
# Build inputs
lua = nixpkgs.luajit;
# # Check inputs
# inherit (nixpkgs)
# fennel-ls
# ;
};
name = "Fennel";
version = "1.5.2-dev";
mkDerivation = {
src = config.deps.fetchFromGitHub {
owner = "reo101";
repo = config.name;
rev = "e8fd00ff52c07f8527989f8df6b57008b656f2d1";
hash = "sha256-26pvDss6MQKiwNzjXX26yidFquFBBlZP7GvlxdwLMCI=";
};
makeFlags = [
"PREFIX=$(out)"
"LUA=${lib.getExe' config.deps.lua "lua"}"
];
nativeBuildInputs = with config.deps; [
];
buildInputs = with config.deps; [
];
# FIXME:
# > fennel-ls --check src/fennel.fnl src/fennel/parser.fnl src/fennel/specials.fnl src/fennel/utils.fnl src/fennel/compiler.fnl src/fennel/macros.fnl src/fennel/match.fnl src/fennel/friend.fnl src/fennel/view.fnl src/fennel/repl.fnl src/launcher.fnl src/fennel/binary.fnl
# > USAGE: fennel-ls [--lint file] [--server]
# checkInputs = with config.deps; [
# fennel-ls
# ];
#
# doCheck = true;
meta = with lib; {
description = " Lua Lisp Language ";
homepage = "https://github.com/reo101/Fennel";
license = licenses.mit;
maintainers = with maintainers; [ reo101 ];
mainProgram = "fennel";
};
};
}