Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luaPackages.lua-resty-jwt: unbreak build #314863

Closed
wants to merge 1 commit into from

Conversation

sveitser
Copy link
Contributor

Fetch missing submodule providing lua-resty-hmac

tag: #ZurichZHF

Description of changes

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Fetch missing submodule providing lua-resty-hmac
@sveitser sveitser requested a review from mrcjkb May 26, 2024 14:20
@sveitser sveitser added 0.kind: ZHF Fixes Fixes during the Zero Hydra Failures (ZHF) campaign backport release-24.05 Backport PR automatically and removed 6.topic: lua labels May 26, 2024
@sveitser
Copy link
Contributor Author

Result of nixpkgs-review pr 314863 run on aarch64-darwin 1

10 packages built:
  • lua51Packages.lua-resty-jwt
  • lua51Packages.lua-resty-openidc
  • lua52Packages.lua-resty-jwt
  • lua52Packages.lua-resty-openidc
  • lua53Packages.lua-resty-jwt
  • lua53Packages.lua-resty-openidc
  • lua54Packages.lua-resty-jwt
  • lua54Packages.lua-resty-openidc
  • luajitPackages.lua-resty-jwt
  • luajitPackages.lua-resty-openidc

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should instead use our version of lua-resty-hmac instead of utilitezing vendoring.

@sveitser
Copy link
Contributor Author

sveitser commented May 27, 2024

I don't know how lua packaging works.

I tried adding

lua-resty-hmac-ffi,,,,,,

to luarocks-packages.csv but the update script said it can't find a rockspec file.

I then tried

lua-resty-hmac-ffi,https://raw.githubusercontent.com/jkeys089/lua-resty-hmac/master/rockspec/lua-resty-hmac-ffi-0.06-1.rockspec,,,,,

which made the update script succeed and added

lua-resty-hmac-ffi = callPackage({ buildLuarocksPackage, fetchFromGitHub, lua }:
buildLuarocksPackage {
  pname = "lua-resty-hmac-ffi";
  version = "0.06-1";

  src = fetchFromGitHub {
    owner = "jkeys089";
    repo = "lua-resty-hmac";
    rev = "0.06-1";
    hash = "sha256-CdYps8gqJqa0UzvZ8CsesEyBIb3rr0ZD+ugCr5P96NM=";
  };

  disabled = lua.luaversion != "5.1";

  meta = {
    homepage = "https://github.com/jkeys089/lua-resty-hmac";
    description = "HMAC functions for ngx_lua and LuaJIT";
    license.fullName = "BSD-2-Clause License";
  };
}) {};

to generated-packages.nix.

The generated package fails to build with

nix-build . -A lua51Packages.lua-resty-hmac-ffi  
this derivation will be built:
  /nix/store/x9nxshr63vic92az9ipdsp64j8fjib48-lua5.1-lua-resty-hmac-ffi-0.06-1.drv
building '/nix/store/x9nxshr63vic92az9ipdsp64j8fjib48-lua5.1-lua-resty-hmac-ffi-0.06-1.drv'...
structuredAttrs is enabled
Running phase: unpackPhase
unpacking source archive /nix/store/qj87v712lzw6kwzd47cj36lb55yp5rq1-source
source root is source
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
Running phase: buildPhase
Running phase: installPhase

Error: File not found: ./lua-resty-hmac-ffi-0.06-1.rockspec

Which seems like a strange error. I'm probably doing something wrong.

@nbraud
Copy link
Contributor

nbraud commented May 27, 2024

I don't know how lua packaging works.

Same 😅

I tried adding lua-resty-hmac-ffi,,,,,, to luarocks-packages.csv but the update script said it can't find a rockspec file.

How did you get luarocks-packages-updater to run? Even giving it my personal access token, I was being rate-limited, and I couldn't figure out a way to make it only generate the new derivation.

[...] The generated package fails to build with

[...]
Error: File not found: ./lua-resty-hmac-ffi-0.06-1.rockspec

I can try to have a look in a short while

@sveitser
Copy link
Contributor Author

sveitser commented May 28, 2024

I got errors with GITHUB_TOKEN and --proc 10 but it ran succesfully to completion with defaults: nix run nixpkgs#luarocks-packages-updater.

It seems to be possible to add a package without updating: nix run nixpkgs#luarocks-packages-updater -- add jkeys089/lua-resty-hmac

Edit: no, this doesn't seem to generate the entry in generated-packages.nix.

@sveitser
Copy link
Contributor Author

The Error: File not found: ./lua-resty-hmac-ffi-0.06-1.rockspec is due to the rockspec file not being in the root of the repo. Can work around that with an override

  lua-resty-hmac-ffi = prev.lua-resty-hmac-ffi.overrideAttrs (oa: {
    postConfigure = ''
      rockspecFilename=rockspec/''${rockspecFilename}
    '';
  });

I tried to add a patch to remove the vendored dependency

From 60733110bc506fff2989371ad6db46d470b34f4a Mon Sep 17 00:00:00 2001
From: sveitser <[email protected]>
Date: Tue, 28 May 2024 11:51:31 +0200
Subject: [PATCH] patch rockspec

---
 lua-resty-jwt-dev-0.rockspec | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lua-resty-jwt-dev-0.rockspec b/lua-resty-jwt-dev-0.rockspec
index 89f80b0..97968e4 100644
--- a/lua-resty-jwt-dev-0.rockspec
+++ b/lua-resty-jwt-dev-0.rockspec
@@ -17,14 +17,14 @@ description = {
 }
 dependencies = {
   'lua >= 5.1',
-  'lua-resty-openssl >= 0.6.8'
+  'lua-resty-openssl >= 0.6.8',
+  'lua-resty-hmac >= '0.06-1'
 }
 build = {
   type = 'builtin',
   modules = {
     ['resty.jwt'] = 'lib/resty/jwt.lua',
     ['resty.evp'] = 'lib/resty/evp.lua',
-    ['resty.jwt-validators'] = 'lib/resty/jwt-validators.lua',
-    ['resty.hmac'] = 'third-party/lua-resty-hmac/lib/resty/hmac.lua'
+    ['resty.jwt-validators'] = 'lib/resty/jwt-validators.lua'
   }
 }
--
2.44.1

And apply it with

  lua-resty-jwt = prev.lua-resty-jwt.overrideAttrs (_: {
    patches = [ ./resty-jwt.patch ];
    postConfigure = ''
      cat ''${rockspecFilename}
    '';
  });

The patch applies fine but the rockspec file is unchanged.

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label May 29, 2024
@poscat0x04
Copy link
Contributor

LGTM, tested using the nginx lua module

@teto
Copy link
Member

teto commented Jun 1, 2024

luarocks-nix started using nurl in its last update and we disabled submodules by default without a way to pass it back. Ideally nurl would have a --submodule=auto flag see nix-community/nurl#338 .
Is anyone interested in becoming maintainer for this package ?

@teto
Copy link
Member

teto commented Oct 2, 2024

this looks fixed on master

@mrcjkb
Copy link
Member

mrcjkb commented Oct 3, 2024

Yep, this was fixed in #341614.

@sveitser sveitser closed this Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: ZHF Fixes Fixes during the Zero Hydra Failures (ZHF) campaign 10.rebuild-darwin: 11-100 10.rebuild-linux: 11-100 12.approvals: 1 This PR was reviewed and approved by one reputable person backport release-24.05 Backport PR automatically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants