From f3d6b2ebef9041b89ce6a5ad929425bddb15c863 Mon Sep 17 00:00:00 2001 From: lucasew Date: Thu, 5 Sep 2024 17:16:58 -0300 Subject: [PATCH] emilua: add setup hook that populates EMILUA_PATH Signed-off-by: lucasew --- .../development/interpreters/emilua/default.nix | 7 +++++++ .../interpreters/emilua/setup-hook.sh | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 pkgs/development/interpreters/emilua/setup-hook.sh diff --git a/pkgs/development/interpreters/emilua/default.nix b/pkgs/development/interpreters/emilua/default.nix index bdacb3a5c087..bb8b22069f86 100644 --- a/pkgs/development/interpreters/emilua/default.nix +++ b/pkgs/development/interpreters/emilua/default.nix @@ -110,6 +110,13 @@ stdenv.mkDerivation (self: { "--no-suite" "libpsx" ]; + postInstall = '' + mkdir -p $out/nix-support + cp ${./setup-hook.sh} $out/nix-support/setup-hook + substituteInPlace $out/nix-support/setup-hook \ + --replace @sitePackages@ "${self.passthru.sitePackages}" + ''; + passthru = { updateScript = gitUpdater {rev-prefix = "v";}; inherit boost; diff --git a/pkgs/development/interpreters/emilua/setup-hook.sh b/pkgs/development/interpreters/emilua/setup-hook.sh new file mode 100644 index 000000000000..034b52796468 --- /dev/null +++ b/pkgs/development/interpreters/emilua/setup-hook.sh @@ -0,0 +1,17 @@ +addEmiluaPath() { + addToSearchPathWithCustomDelimiter : EMILUA_PATH $1/@sitePackages@ +} + +toEmiluaPath() { + local paths="$1" + local result= + for i in $paths; do + p="$i/@sitePackages@" + result="${result}${result:+:}$p" + done + echo $result +} + +if [ -z "${dontAddEmiluaPath:-}" ]; then + addEnvHooks "$hostOffset" addEmiluaPath +fi