summaryrefslogtreecommitdiffstats
path: root/pkgs/development/interpreters
diff options
context:
space:
mode:
authorMatthieu Coudron <teto@users.noreply.github.com>2021-09-01 10:31:14 +0200
committerGitHub <noreply@github.com>2021-09-01 10:31:14 +0200
commitb4e6ec08f45b3fa31f879b45a6f1dc6051608118 (patch)
tree9d65ac5b1a13e02ab3ff7a124654a281527fadfc /pkgs/development/interpreters
parent93b0f6be1373818d1d9a3a76c141800251103d00 (diff)
parente62a0eac8f2cfe58efae9200f9d267169f519cab (diff)
Merge pull request #134336 from teto/luarocks-rockspec-relpath
lua updater: support in-repo rockspecs
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r--pkgs/development/interpreters/lua-5/build-lua-package.nix28
1 files changed, 12 insertions, 16 deletions
diff --git a/pkgs/development/interpreters/lua-5/build-lua-package.nix b/pkgs/development/interpreters/lua-5/build-lua-package.nix
index 74f5b2b7b395..5639b2a4bb90 100644
--- a/pkgs/development/interpreters/lua-5/build-lua-package.nix
+++ b/pkgs/development/interpreters/lua-5/build-lua-package.nix
@@ -7,8 +7,7 @@
}:
{
-name ? "${attrs.pname}-${attrs.version}"
-
+pname
, version
# by default prefix `name` e.g. "lua5.2-${name}"
@@ -60,7 +59,9 @@ name ? "${attrs.pname}-${attrs.version}"
# The two above arguments have access to builder variables -- e.g. to $out
# relative to srcRoot, path to the rockspec to use when using rocks
-, rockspecFilename ? "../*.rockspec"
+, rockspecFilename ? null
+# relative to srcRoot, path to folder that contains the expected rockspec
+, rockspecDir ? "."
# must be set for packages that don't have a rock
, knownRockspec ? null
@@ -71,6 +72,9 @@ name ? "${attrs.pname}-${attrs.version}"
# Keep extra attributes from `attrs`, e.g., `patchPhase', etc.
let
+ generatedRockspecFilename = "${rockspecDir}/${pname}-${version}.rockspec";
+
+
# TODO fix warnings "Couldn't load rockspec for ..." during manifest
# construction -- from initial investigation, appears it will require
# upstream luarocks changes to fix cleanly (during manifest construction,
@@ -144,7 +148,7 @@ in
toLuaModule ( lua.stdenv.mkDerivation (
builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps" "extraVariables"] // {
- name = namePrefix + name;
+ name = namePrefix + pname + "-" + version;
buildInputs = [ wrapLua lua.pkgs.luarocks ]
++ buildInputs
@@ -159,20 +163,8 @@ builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps" "extraVariab
# @-patterns do not capture formal argument default values, so we need to
# explicitly inherit this for it to be available as a shell variable in the
# builder
- inherit rockspecFilename;
inherit rocksSubdir;
- # enabled only for src.rock
- setSourceRoot= let
- name_only= lib.getName name;
- in
- lib.optionalString (knownRockspec == null) ''
- # format is rockspec_basename/source_basename
- # rockspec can set it via spec.source.dir
- folder=$(find . -mindepth 2 -maxdepth 2 -type d -path '*${name_only}*/*'|head -n1)
- sourceRoot="$folder"
- '';
-
configurePhase = ''
runHook preConfigure
@@ -181,6 +173,9 @@ builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps" "extraVariab
EOF
export LUAROCKS_CONFIG="$PWD/${luarocks_config}";
''
+ + lib.optionalString (rockspecFilename == null) ''
+ rockspecFilename="${generatedRockspecFilename}"
+ ''
+ lib.optionalString (knownRockspec != null) ''
# prevents the following type of error:
@@ -192,6 +187,7 @@ builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps" "extraVariab
runHook postConfigure
'';
+ # TODO could be moved to configurePhase
buildPhase = ''
runHook preBuild