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/gem: fix path to git checkout #58940
Conversation
In case of the gem type 'git', nix-bundle-install.rb was called with wrong path to the git checkout. ${src} does contain the sources, but not the newly generated .git dir, which is created in the buildPhase of pkgs/development/ruby-modules/gem/default.nix In some rare cases, this .git dir is needed at installPhase.
Ah, what i forgot to mention: If this is actually a fix, I'd say it's worth to backport to |
@@ -179,7 +179,7 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // { | |||
'${version}' \ | |||
'${lib.escapeShellArgs buildFlags}' \ | |||
'${attrs.source.url}' \ | |||
'${src}' \ | |||
'.' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want to use $NIX_BUILD_TOP here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, didn't know about that variable. If I do "$NIX_BUILD_TOP" \
for that line, I still get this error on my test case:
$ nix-build
these derivations will be built:
/nix/store/3hfcigzb57ijdvs6msn0ik4lzk73s9nv-ruby2.5.5-http_parser.rb-0.6.1.drv
/nix/store/ana9rq1r399wnmvlv9kxw76zxmjdqgqg-ruby-env.drv
building '/nix/store/3hfcigzb57ijdvs6msn0ik4lzk73s9nv-ruby2.5.5-http_parser.rb-0.6.1.drv'...
unpacking sources
unpacking source archive /nix/store/rfgsdvv1mxi6kj07xiijhzhz8dps65h3-http_parser.rb-225354b
source root is http_parser.rb-225354b
patching sources
configuring
no configure script, doing nothing
building
Initialized empty Git repository in /build/http_parser.rb-225354b/.git/
installing
buildFlags:
`/homeless-shelter` is not a directory.
Bundler will use `/build/bundler/home/unknown' as your home directory temporarily.
/nix/store/rwp5fpzqssf5m9dzbgbwsfgdzw8xajra-ruby-2.5.5/lib/ruby/2.5.0/fileutils.rb:1227:in `stat': No such file or directory @ rb_file_s_stat - /build/.git (Errno::ENOENT)
from /nix/store/rwp5fpzqssf5m9dzbgbwsfgdzw8xajra-ruby-2.5.5/lib/ruby/2.5.0/fileutils.rb:1227:in `lstat'
from /nix/store/rwp5fpzqssf5m9dzbgbwsfgdzw8xajra-ruby-2.5.5/lib/ruby/2.5.0/fileutils.rb:1256:in `copy'
from /nix/store/rwp5fpzqssf5m9dzbgbwsfgdzw8xajra-ruby-2.5.5/lib/ruby/2.5.0/fileutils.rb:418:in `block in copy_entry'
from /nix/store/rwp5fpzqssf5m9dzbgbwsfgdzw8xajra-ruby-2.5.5/lib/ruby/2.5.0/fileutils.rb:1390:in `wrap_traverse'
from /nix/store/rwp5fpzqssf5m9dzbgbwsfgdzw8xajra-ruby-2.5.5/lib/ruby/2.5.0/fileutils.rb:415:in `copy_entry'
from /nix/store/rwp5fpzqssf5m9dzbgbwsfgdzw8xajra-ruby-2.5.5/lib/ruby/2.5.0/fileutils.rb:393:in `block in cp_r'
from /nix/store/rwp5fpzqssf5m9dzbgbwsfgdzw8xajra-ruby-2.5.5/lib/ruby/2.5.0/fileutils.rb:1463:in `block in fu_each_src_dest'
from /nix/store/rwp5fpzqssf5m9dzbgbwsfgdzw8xajra-ruby-2.5.5/lib/ruby/2.5.0/fileutils.rb:1479:in `fu_each_src_dest0'
from /nix/store/rwp5fpzqssf5m9dzbgbwsfgdzw8xajra-ruby-2.5.5/lib/ruby/2.5.0/fileutils.rb:1461:in `fu_each_src_dest'
from /nix/store/rwp5fpzqssf5m9dzbgbwsfgdzw8xajra-ruby-2.5.5/lib/ruby/2.5.0/fileutils.rb:392:in `cp_r'
from /nix/store/6g99037s460cbv2drh4l7hrny09lc19q-nix-bundle-install.rb:92:in `checkout'
from /nix/store/q3m22q8z2rsq1hjy6lsv4amavyf872lw-bundler-1.17.2/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/source/git.rb:303:in `fetch'
from /nix/store/q3m22q8z2rsq1hjy6lsv4amavyf872lw-bundler-1.17.2/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/source/git.rb:161:in `specs'
from /nix/store/6g99037s460cbv2drh4l7hrny09lc19q-nix-bundle-install.rb:119:in `<main>'
builder for '/nix/store/3hfcigzb57ijdvs6msn0ik4lzk73s9nv-ruby2.5.5-http_parser.rb-0.6.1.drv' failed with exit code 1
cannot build derivation '/nix/store/ana9rq1r399wnmvlv9kxw76zxmjdqgqg-ruby-env.drv': 1 dependencies couldn't be built
error: build of '/nix/store/ana9rq1r399wnmvlv9kxw76zxmjdqgqg-ruby-env.drv' failed
Is there any case where .
could go wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose there's not. It seems weird to have the parameter that only receives (AFAICT) a constant value, though. Either it should be removed as a parameter (and the receiving script updated appropriately) or the variation is significant and there's something we're missing?
Thanks for making the experiment. I'm sorry for the bum steer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm quite curious about wether I missed something. Makes sense what you say about that constant parameter. Let's see wether someone else finds a problem here before I refactor that.
This seems like a good fix to me and doens't break anything I checked. |
This pull request has been mentioned on Nix community. There might be relevant details there: |
Motivation for this change
I want to build the following
bundlerEnv
, that is not so far from my actual case (packaging Mastodon).Building that on
master
fails with an error:As
No such file or directory @ rb_file_s_stat - /nix/store/rfgsdvv1mxi6kj07xiijhzhz8dps65h3-http_parser.rb-225354b/.git (Errno::ENOENT)
says, the.git
directory needs to accessed but is missing. That makes me wonder, as innixpkgs/pkgs/development/ruby-modules/gem/default.nix
Line 146 in e4d2143
.git
dir.Things done
Finally I came to the conclusion, that the wrong path was given to
nix-bundle-install.rb
and it is supposed to be the build dir, not the$src
store path. That makes the formerbundlerEnv
build.cc'ing @cstrahan as they wrote that code in b6c06e2. Also @nyarly, you touched that file recently.
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)