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

ruby: add bundler options #579

Merged
merged 5 commits into from
May 19, 2023

Conversation

bobvanderlinden
Copy link
Contributor

Currently there is no way to disable bundler nor is it possible to alter the bundler package.

In addition, there was a problem with the prioritization of the ruby/bundler packages, as modern ruby packages include a bundler executable.

This was reported here: bobvanderlinden/nixpkgs-ruby#72

I also wanted to avoid regressions, so I added a stricter example/test.

Resolves bobvanderlinden/nixpkgs-ruby#72

@bobvanderlinden
Copy link
Contributor Author

@ryansch could you give this a try?

@domenkozar
Copy link
Member

Seems like the ruby test is still failing

@bobvanderlinden
Copy link
Contributor Author

Found out the problem. Bundler was internally still using the Ruby version from nixpkgs.
When I pkgs.bundler.override { ruby = cfg.package; } I ran into a strange issue where env inside mkDerivation was not supported. This was because nixpkgs-ruby was still based on nixos-22.11, while devenv was using nixpkgs-unstable. The env in mkDerivation was introduced inbetween these versions(?).
To circumvent this I've let the nixpkgs-ruby input follow nixpkgs in the Ruby example.

@bobvanderlinden
Copy link
Contributor Author

I ran the following, which succeeds locally. 🤞 that this works for CI as well:

git checkout . && git clean -xdf && pushd examples/ruby && mv devenv.yaml devenv.yaml.orig && awk '
            { print }
            /^inputs:$/ {
              print "  devenv:";
              print "    url: path:../../src/modules";
            }
          ' devenv.yaml.orig > devenv.yaml && popd && devenv-test-example ruby

@bobvanderlinden
Copy link
Contributor Author

bobvanderlinden commented May 17, 2023

It seems that the self-hosted MacOS machine doesn't have xcode installed (or isn't up-to-date?). The native dependencies fail to build:

`try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.

I think the x86_64-darwin build automatically comes with xcode installed, so it relies on those libraries to build the native dependencies.

I'm contemplating whether to include darwin.apple_sdk.frameworks.* or whether rely on preinstalled xcode.

I see that the rust has:

env.CFLAGS = [ "-iframework ${config.env.DEVENV_PROFILE}/Library/Frameworks" ];

Should this be part of languages.c?

I'm also wondering whether #507 would already add CFLAGS when the right frameworks are chosen.

@domenkozar
Copy link
Member

We should rely on xcode not being installed and list all the deps we need. Most likely #507 addresses this, I'll look into it next week.

For the YAML schema I was hoping we can render it with strictyaml, how can we keep it in sync with the validation logic. Any ideas?

@bobvanderlinden
Copy link
Contributor Author

We should rely on xcode not being installed and list all the deps we need.

That would indeed be the most reliable. I'm guessing people aren't using it this way yet though 😅

For the YAML schema I was hoping we can render it with strictyaml, how can we keep it in sync with the validation logic. Any ideas?

Are you referring to making changes in the tests (like awk does currently)? If so, I was thinking maybe all tests could be run inside a Nix build using something like __impure. That way changes to the tests can be reproduced more easily.

But maybe I'm not understanding what you meant by validation logic?

@sandydoo
Copy link
Member

@bobvanderlinden, if you'd like to rebase this over master, I can help iron out the remaining macos issues 🙂

@bobvanderlinden
Copy link
Contributor Author

bobvanderlinden commented May 19, 2023

@bobvanderlinden, if you'd like to rebase this over master, I can help iron out the remaining macos issues 🙂

I had some other PRs that were becoming problematic with the lack of a MacOS system, so I have put in some time to get my old x86_64 mac working again. 👍 I was able to reproduce the problem by not installing xcode.

EDIT: Ah! I just saw your addition of libllvm, I think that fixed it here as well. Nice 👍 I rebased the PR.

@sandydoo
Copy link
Member

EDIT: Ah! I just saw your addition of libllvm, I think that fixed it here as well. Nice 👍 I rebased the PR.

Yeah, sorry, I really should've mentioned that 😂

@sandydoo sandydoo merged commit 82b7735 into cachix:main May 19, 2023
@bobvanderlinden bobvanderlinden deleted the pr-ruby-bundler-options branch May 20, 2023 06:41
@bobvanderlinden
Copy link
Contributor Author

Awesome, thanks!

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 this pull request may close these issues.

Customize bundler version
3 participants