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

Is it possible to use this alongside node2nix? #21

Open
driusan opened this issue Jun 17, 2021 · 2 comments
Open

Is it possible to use this alongside node2nix? #21

driusan opened this issue Jun 17, 2021 · 2 comments

Comments

@driusan
Copy link

driusan commented Jun 17, 2021

I'm trying to build a package for a PHP app that uses composer for managing php dependencies and npm for managing javascript dependencies. I'm able to use either node2nix or this repo to independently to have nix-build build either the PHP or the js dependencies, but I haven't been able to find any way to compose the two to build a package with which derives both the javascript and php dependencies at the same time.

Is there a way to use the derivations from the two x2nix programs at the same time? (I'm fairly new to nix so I may be missing something obvious.)

@charlieshanley
Copy link

For posterity, here's the general contour of what I did when I had this use case:

let
  npmPackage = (callPackage ./deps/node-composition.nix {}).package.override {
    postInstall = ''
      npm run build
    '';
  };
  phpPackage = callPackage ./deps/php-composition.nix { noDev = true; };
in
  # Compose the npm and php packages together
  runCommand "package-with-js-and-php-deps" {} ''
    mkdir $out
    ${rsync}/bin/rsync -a ${npmPackage}/lib/node_modules/package/ ${phpPackage}/ $out
  ''

@svanderburg
Copy link
Owner

At the moment this is not possible without any hacks/workarounds. However, I have some future plans to also allow substituting dependencies before npm/composer is invoked. I'm already working on it for a while, but it is going to take time -- it requires some major re-architecting to make this happen.

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

No branches or pull requests

3 participants