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-modules: Import gemset if it's a path OR a string. #38959

Merged
merged 1 commit into from Apr 15, 2018

Conversation

siers
Copy link
Member

@siers siers commented Apr 15, 2018

Commit comment:

This fixes the bug introduced by [@aneeshusa's] 8686b98 which broke bundlerEnv
exprs when gemdir was a string (thus making gemset a string by
gemset = gemdir + "/gemset.nix") which made it being treated as a
set.


pkgs/development/ruby-modules/bundled-common/functions.nix:

  gemset =
    if gemset == null then assert gemdir != null; gemdir + "/gemset.nix"
    else gemset;

pkgs/development/ruby-modules/bundled-common/default.nix:

importedGemset = if builtins.typeOf gemFiles.gemset == "path"
    then import gemFiles.gemset
    else gemFiles.gemset;

I stumbled upon this because I set gemdir to the value of a filterSource expression, which is a string.

nix-repl> builtins.typeOf (builtins.filterSource (_: _: true) <nixpkgs/lib>)                   
"string"
Motivation for this change

Try building pkgs/servers/monitoring/sensu/default.nix on the latest master(e.g. 92f0d31b949bcf018262 with this change:

    diff --git a/pkgs/servers/monitoring/sensu/default.nix b/pkgs/servers/monitoring/sensu/default.nix
    index dba0c32b353..cbbc50b6b1b 100644
    --- a/pkgs/servers/monitoring/sensu/default.nix
    +++ b/pkgs/servers/monitoring/sensu/default.nix
    @@ -5,7 +5,7 @@ bundlerEnv rec {
       version = (import ./gemset.nix).sensu.version;

       inherit ruby;
    -  gemdir = ./.;
    +  gemdir = "${./.}";

       meta = with lib; {
         description = "A monitoring framework that aims to be simple, malleable, and scalable";

It ain't gonna build, but it did before.

This fixes the bug introduced by 8686b98 which broke bundlerEnv
exprs when gemdir was a string (thus making gemset a string by
`gemset = gemdir + "/gemset.nix"`) which made it being treated as a
set.
@zimbatm
Copy link
Member

zimbatm commented Apr 15, 2018

yep makes sense, thanks!

@siers
Copy link
Member Author

siers commented Apr 15, 2018

Thank you!

@siers
Copy link
Member Author

siers commented Apr 15, 2018

@zimbatm Care to pick on the 18.03, so I wouldn't have to work with a local checkout? :)

@aneeshusa
Copy link
Contributor

Thanks for catching + patching this @siers, as you can tell I'm not the most familiar with our Ruby infrastructure :)

zimbatm pushed a commit that referenced this pull request Apr 16, 2018
This fixes the bug introduced by 8686b98 which broke bundlerEnv
exprs when gemdir was a string (thus making gemset a string by
`gemset = gemdir + "/gemset.nix"`) which made it being treated as a
set.

(cherry picked from commit a6a2e75)
@zimbatm
Copy link
Member

zimbatm commented Apr 16, 2018

pushed in 7ea6c39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants