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

Fix ruby built #28083

Closed
wants to merge 1 commit into from
Closed

Fix ruby built #28083

wants to merge 1 commit into from

Conversation

dpino
Copy link

@dpino dpino commented Aug 9, 2017

Motivation for this change

When trying to build package ruby from master, I got the following error:

$ sudo nix-build -A ruby
error: cannot coerce a set to a string, at /home/dpino/workspace/nixpkgs/pkgs/development/interpreters/ruby/default.nix:57:17

Actually I for this error after upgrading from 16.09 to 17.03. Running a nix-env command returned the same error:

$ nix-env -qaP ruby
error: cannot coerce a set to a string, at /nix/store/v1zvii5pzvx76dgkb8ifdsyp8fwj6ng6-nixos-17.03.1661.1f7114aec3/nixos/pkgs/development/interpreters/ruby/default.nix:57:17

This happened not only when searching package ruby, but any other package.

Things done

Please check what applies. Note that these are not hard requirements but merely serve as information for reviewers.

  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@@ -49,12 +49,12 @@ let
rev = tag;
sha256 = sha256.git;
} else fetchurl {
url = "http://cache.ruby-lang.org/pub/ruby/${ver.majMin}/ruby-${ver}.tar.gz";
Copy link
Member

@Mic92 Mic92 Aug 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this works for me, if you take a look at ruby-version.nix, you see __toString.
If I add:

url = lib.traceVal "http://cache.ruby-lang.org/pub/ruby/${ver.majMin}/ruby-${ver}.tar.gz";

I see:

trace: http://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.4.tar.gz

Could this error happen when using an old version of nix?

cc: @zimbatm

Copy link
Member

@Mic92 Mic92 Aug 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method was introduced here: NixOS/nix#721
This does not explain, why it happened to you in 16.09.

@globin
Copy link
Member

globin commented Aug 11, 2017

I cannot reproduce this, on which commit are you?

@Mic92
Copy link
Member

Mic92 commented Aug 11, 2017

He must have used a quite old version of nix.

@danbst
Copy link
Contributor

danbst commented Aug 12, 2017

Strange, there should be a check on minimal Nix version before evaluating rest of nixpkgs

@dpino
Copy link
Author

dpino commented Aug 21, 2017

Sorry I couldn't reply earlier, I was on holidays last week.

More info about the issue:

If I check v16.09 of nixpkgs, the command works fine:

$ git co 16.09 -b v16.09
$ git log -1
commit f22817d8d2bc17d2bcdb8ac4308a4bce6f5d1d2b
Author: Susan Potter <me@susanpotter.net>
Date:   Sat Oct 1 14:45:22 2016 -0500

    kibana: fix 4.6.0 for i686

    (cherry picked from commit c3e57f3095d3c5e4631a5978702226ee2b6bd8cd)
$ nix-build -A ruby
/nix/store/g2yx0xc7phhx9ldzj7hasbglrdq8xxs9-ruby-2.3.1-p0

If I check v17.03 of nixpkgs, I can reproduce the issue:

$ git co 17.03 -b v17.03
Switched to branch 'v17.03'
Your branch is behind 'origin/release-17.03' by 884 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
$ git log -1
commit 7dcd3c471f7b2b69135ff93696ff4bf62ee71fb7
Merge: e4b0992 05a2866
Author: Domen Kožar <domen@dev.si>
Date:   Tue Mar 28 16:06:57 2017 +0200

    Merge branch 'staging-17.03' into release-17.03
$ nix-build -A ruby
error: cannot coerce a set to a string, at /home/dpino/workspace/nixpkgs/pkgs/development/interpreters/ruby/default.nix:57:17

If I switch to 17.03 and pull, I can reproduce the issue too:

$ git log -1
commit f4c3bdc1dfdc2418b7b9f908cb254e9fdd883b44
Author: Vladimír Čunát <vcunat@gmail.com>
Date:   Sun Aug 20 13:26:07 2017 +0200

    Merge #28346: readline: bugfix 7.0 -> 7.0.3

    (cherry picked from commit 6c3513b4c0f8722970f12f899135a791a79c4dba)
    They are three simple bugfixes; only bashInteractive uses readline-7;
    (at least) one of the bugs manifests in 17.03.
$ nix-build -A ruby
error: cannot coerce a set to a string, at /home/dpino/workspace/nixpkgs/pkgs/development/interpreters/ruby/default.nix:57:17

Originally my motivation for "fixing" this issue was that when update the nixos channel from 16.09 to 17.03, if I searched for a package (any package), I got the error stated above.

I've tried now to switch to 17.03 from 16.09 and search for a package, and it works fine.

$ sudo nix-channel --list
nixos https://nixos.org/channels/nixos-17.03
$ nix-env -qaP '.*tcpdump.*'
nixos-16.09.tcpdump  tcpdump-4.9.0

I hope this info can shed some light.

@zimbatm
Copy link
Member

zimbatm commented Aug 21, 2017

@dpino can you post the output of nix-env --version?

@dpino
Copy link
Author

dpino commented Aug 21, 2017

@zimbatm

$ nix-env --version
nix-env (Nix) 1.11.13

OTOH, I cannot reproduce the issue anymore. I've to work on this machine, so I cannot keep it on the same state. I don't know what I've done that fixed the issue. I believe it was a sudo nixos-rebuild switch, but I'm not sure about it. Does it make sense?

@danbst
Copy link
Contributor

danbst commented Aug 21, 2017

did you reboot your machine after upgrade to 17.03?

@zimbatm
Copy link
Member

zimbatm commented Aug 21, 2017

This language feature has been introduced in nix 1.11 NixOS/nix@14080f3
(Nov 2015). If you were using an older version that would explain the issue.

After some point the best upgrade path would be to install a new version of nix and then re-build the system based on that.

@dpino
Copy link
Author

dpino commented Aug 21, 2017

@danbst No, I didn't.

@zimbatm OK, sounds reasonable. In /etc/nixos/configuration.nix, I can see the following:

# The NixOS release to be compatible with for stateful data such as databases.
system.stateVersion = "15.09";

Likely this system was using 15.09 although as far as I recall I was using 16.03 as nixos channel (which would include the Nov 2015 changes), but perhaps I add the channel and I didn't update or upgrade the system. According to what you said, this seemed to be the issue.

@danbst
Copy link
Contributor

danbst commented Aug 22, 2017

yup, reproduced the error on 15.09 vagrant nixbox, which has nix 1.10

@danbst
Copy link
Contributor

danbst commented Aug 22, 2017

So, I've bumped Nix version for future 17.09 to Nix 1.11 (hope it will be merged soon), but it won't go into 17.03. Unfortunately, that doesn't solve a problem, it only can help people when they update from 15.09 to 17.09 in one go. So this PR is still valid for 17.03.

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

6 participants