NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.55k stars 13.72k forks source link

[ruby] bundlerEnv does not respect propagatedBuildInputs #105079

Open darkleaf opened 3 years ago

darkleaf commented 3 years ago

Describe the bug

bundlerEnv does not respect propagatedBuildInputs.

gem-config/default.nix defines propagatedBuildInputs for the execjs gem:

  execjs = attrs: {
    propagatedBuildInputs = [ v8 ];
  };

I expect that when I install my gems then my PATH will contain the d8 binary from the v8 package.

To Reproduce

  1. clone https://github.com/darkleaf/nix-gem-propagated-build-inputs-bug
  2. nix-shell --pure -v
  3. type d8 and press enter
  4. bash: d8: command not found

Expected behavior

d8 will run the REPL session

You can uncomment pkgs.v8 in the shell.nix file.

Notify maintainers

@manveru

Metadata

It also reproduces on Linux.

jonringer commented 3 years ago

I expect that when I install my gems then my PATH will contain the d8 binary from the v8 package.

propagatedBuildInputs will allow those inputs to be available on the next downstream dependency. It doesn't give any guarantee about the dependencies being available in the user env.

The package will need to be patched so that when it shells out to the command, it's referencing a store path instead of just a command name.

propagatedNativeBuildInputs may work... but not sure

darkleaf commented 3 years ago

It doesn't give any guarantee about the dependencies being available in the user env.

The execjs gem requires a JavaSritpt engine as a runtime dependency in the user env. This is the only reason to add propagatedBuildInputs to the spec, is not it?

Or maybe this is a mistake? Should the spec contain the propagatedBuildInputs key?

jonringer commented 3 years ago

This is the only reason to add propagatedBuildInputs to the spec, is not it?

It doesn't add it to the environment.

This is a common issue in python as well, the solutions is patch the correct nix logic into the package. Something similar to: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/ffmpeg-python/default.nix and https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/ffmpeg-python/ffmpeg-location.patch

darkleaf commented 3 years ago

Thank you! Great examples! I've understood you now.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info