From b35e6362a00148ff1c8ff17036b4aad6457bd4b6 Mon Sep 17 00:00:00 2001 From: reo101 Date: Sun, 15 Sep 2024 14:49:10 +0300 Subject: [PATCH] feat(packages): add `fennel` and `fennel-ls` Built using `dream2nix`, based on my (reo101) forks of both projects --- pkgs/fennel-ls/default.nix | 55 ++++++++++++++++++++++++++++++++ pkgs/fennel/default.nix | 65 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 pkgs/fennel-ls/default.nix create mode 100644 pkgs/fennel/default.nix diff --git a/pkgs/fennel-ls/default.nix b/pkgs/fennel-ls/default.nix new file mode 100644 index 0000000..1457f58 --- /dev/null +++ b/pkgs/fennel-ls/default.nix @@ -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"; + }; + }; +} diff --git a/pkgs/fennel/default.nix b/pkgs/fennel/default.nix new file mode 100644 index 0000000..9cf52a7 --- /dev/null +++ b/pkgs/fennel/default.nix @@ -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"; + }; + }; +}