From cf660fa367fdb31d571c6850c10a4a0505e87aa6 Mon Sep 17 00:00:00 2001 From: LeMarsu Date: Wed, 11 Mar 2026 21:29:29 +0100 Subject: [PATCH] refactor: sloth plugin derivation is less hackish --- lib/modules/sloth.nix | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/modules/sloth.nix b/lib/modules/sloth.nix index 1340f84..e92718a 100644 --- a/lib/modules/sloth.nix +++ b/lib/modules/sloth.nix @@ -9,8 +9,8 @@ fs = pkgs.lib.fileset; lua = callModule ../lua.nix {}; - versionLua = version: with lua; renderLua {} (return (lambda [] (return version))); - luaDefsToLua = luaDefs: with lua; renderLua {} (return luaDefs); + defsFile = luaDefs: with lua; writeLua "sloth-plugins-definitions.lua" (return luaDefs); + versionFile = with lua; writeLua "sloth-version.lua" (return (lambda [] (return sloth.version))); in fix (self: { mkSlothPlugin = luaDefs: @@ -24,14 +24,8 @@ in nvimRequireCheck = "sloth-flake"; buildPhase = '' dir=lua/sloth-flake - - cat <<'LUA' > $dir/dependencies.lua - ${luaDefsToLua luaDefs} - LUA - - cat <<'LUA' > $dir/version.lua - ${versionLua sloth.version} - LUA + ln -s ${defsFile luaDefs} $dir/dependencies.lua + ln -s ${versionFile} $dir/version.lua ''; };