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

preRebuild equivalent for buildNodeShell #226

Open
kylegentle opened this issue Feb 2, 2021 · 0 comments · May be fixed by #266
Open

preRebuild equivalent for buildNodeShell #226

kylegentle opened this issue Feb 2, 2021 · 0 comments · May be fixed by #266

Comments

@kylegentle
Copy link
Contributor

Is there any way to generate a development shell for a package that requires build-time dependency wrapping/patching?

Context:

I'm trying to create a development environment for a basic NextJS project. NextJS requires the sharp library, which has an implicit dependency on a specific version of libvips.

There is an example of patching a package dependency in the Wrapping or patching the code or any of its dependencies section of the README. This approach works to generate a package; here's my override.nix:

{ pkgs ? import <nixpkgs> {
  inherit system;
}, system ? builtins.currentSystem }:

let
  name = "my-nextjs-package";
  vipsVersion = "8.10.0";
  nodePackages = import ./default.nix {
    inherit pkgs system;
  };
  sharpVips = builtins.fetchurl {
    url = "https://github.com/lovell/sharp-libvips/releases/download/v${vipsVersion}/libvips-${vipsVersion}-linux-x64.tar.gz";
    sha256 = "0a6digd1bmb96zzyqahgmlv1r0gbb2dj1n37plm6xga3fmf1xiwi";
  };
  vendorDir = "$out/lib/node_modules/${name}/node_modules/sharp/vendor/${vipsVersion}";
in
nodePackages // {
  package = nodePackages.package.override {
    preRebuild = ''
      mkdir -p ${vendorDir}
      tar -xvf ${sharpVips} -C ${vendorDir}
    '';
  };
}

How can I do the same thing, but for a shell environment? #44 is closely related, although I see it was closed some time ago.

@thomasjm thomasjm linked a pull request Oct 14, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant