bundix icon indicating copy to clipboard operation
bundix copied to clipboard

Cannot install webpacker

Open kovkev opened this issue 7 years ago • 6 comments

[nix-shell:~/human]$ cat ~/temp/default.nix 
with (import <nixpkgs> {});
let
  gems = bundlerEnv {
    name = "your-package";
    inherit ruby;
    gemdir = ./.;
  };
in stdenv.mkDerivation {
  name = "your-package";
  buildInputs = [gems ruby];
}

Packages used by the current nix-shell

[nix-shell:~/human]$ cat ./default.nix 
with (import <nixpkgs> {});
let
  gems = bundlerEnv {
    name = "your-package";
    inherit ruby;
    gemdir = ./.;
  };
in stdenv.mkDerivation {
  name = "your-package";
  buildInputs = [
gems
ruby
libffi
unison
purePackages.ffi
postgresql
nodejs
yarn
ruby
redis
sqlite
];
}

The current versions of everything and my attempt to install webpacker.

[nix-shell:~/human]$ bash doitall.sh 
+ bundle --version
Warning: the running version of Bundler (1.14.6) is older than the version that crea
ed the lockfile (1.16.0). We suggest you upgrade to the latest version of Bundler by
running `gem install bundler`.
Bundler version 1.14.6
+ ruby --version
ruby 2.3.5p376 (2017-09-14) [x86_64-linux]
+ irb --version
irb 0.9.6(09/06/30)
+ bundix --version
2.3.1
+ rails --version
Rails 5.1.5
+ tail Gemfile.lock
  spring-watcher-listen (~> 2.0.0)
  sqlite3
  turbolinks (~> 5)
  tzinfo-data
  uglifier (>= 1.3.0)
  web-console (>= 3.3.0)
  webpacker

BUNDLED WITH
   1.16.0
+ bundle binstubs webpacker
Warning: the running version of Bundler (1.14.6) is older than the version that crea
ed the lockfile (1.16.0). We suggest you upgrade to the latest version of Bundler by
running `gem install bundler`.
There was an error accessing
`/nix/store/bfvgqh7wy75ds3xzdmimb08pgnhfsc9m-gemfile-and-lockfile/bin`.
The underlying system error is Errno::EROFS: Read-only file system @ dir_s_mkdir -
/nix/store/bfvgqh7wy75ds3xzdmimb08pgnhfsc9m-gemfile-and-lockfile/bin

[nix-shell:~/human]$ 

Notice the Warning on the Bundler version. Notice 1.14.6 as per the bundler command and 1.16.0 as per the Gemfile.lock.

The Gemfile.lock was generated using bundix -l as I understand it.

[nix-shell:~/human]$ bundle exec rails webpacker:verify_install
Warning: the running version of Bundler (1.14.6) is older than the version that crea
ed the lockfile (1.16.0). We suggest you upgrade to the latest version of Bundler by
running `gem install bundler`.
Webpack binstubs not found.
Have you run rails webpacker:install ?
Make sure the bin directory or binstubs are not included in .gitignore
Exiting!

[nix-shell:~/human]$ 

run bundle binstubs webpacker from "." happens when I run bundle exec rails webpacker:install

I'm not sure how it ends up using bundler version 1.16.0 when bundix does:

https://github.com/manveru/bundix/blob/e2195372df0ca2c630150b0321474d56ae26844e/lib/bundix/commandline.rb#L141

and the currently delivered version of bundler by the nixos packages repository is version 1.14.6,

and it seems that's what the bundix default.nix installs, as per:

https://github.com/manveru/bundix/blob/7b3c876a2d20c61ba895002fca1789b3dd11b582/default.nix#L4

I have not found how to install binstubs through bundix.

kovkev avatar Mar 02 '18 06:03 kovkev

Can you try this?

with import (fetchTarball {
  url = https://github.com/NixOS/nixpkgs-channels/archive/3265226fec3bd568d5828485c03e15e2e87d3d12.tar.gz;
  sha256 = "10rmdj6zbh9da4rhrs77yhvckjlpfqbz5208zdjysvlv28wj9yd5";
}) {};
let
  gems = bundlerEnv {
    name = "your-package";
    ruby = ruby_2_5;
    gemdir = ./.;
  };
in stdenv.mkDerivation {
  name = "your-package";
  buildInputs = [gems gems.wrappedRuby];
}

Also, you never need to do bundle exec with a bundlerEnv. We updated bundler recently in nixpkgs, so you should be getting 1.16.1.

manveru avatar Mar 02 '18 09:03 manveru

I see bundler 1.14.6

[nix-shell:~/human]$ nix-env -qaP | grep bundler
nixos.bundler_HEAD                                             bundler-1.14.6
nixos.bundler                                                  bundler-1.14.6

[nix-shell:~/human]$ 

Also, with the default.nix content you propose, I get

[nix-shell:~/human]$ nix-shell default.nix
error: unsupported argument ‘sha256’ to ‘fetchTarball’, at 0xf54b78

[nix-shell:~/human]$ 

I think I need to update my nix or nixos version.

[nix-shell:~/human]$ nixos-version
17.09.2681.59661f21be6 (Hummingbird)

[nix-shell:~/human]$ nix-env --version
nix-env (Nix) 1.11.16

[nix-shell:~/human]$ 

kovkev avatar Mar 02 '18 18:03 kovkev

Yeah, I'd recommend using a newer nix. You can still use the default.nix if you remove the sha256 line, it's just going to download it every couple of hours.

manveru avatar Mar 02 '18 20:03 manveru

Hi manveru,

I appreciate your support a lot. I was successful in getting nix 2.0 and then bundler 1.16.1 installed on my ec2 instance.

Now, when I try to install webpacker, I get

[nix-shell:~/human]$ bundle exec rails webpacker:install
Could not find public_suffix-3.0.2 in any of the sources
Run `bundle install` to install missing gems.

kovkev avatar Mar 03 '18 03:03 kovkev

When I try bundix -m, I get

...
current directory:
/home/vagrant/human/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
/nix/store/d80jck15rrpn9kydlsl2c9ca4adg1axx-ruby-2.3.5/bin/ruby -r
./siteconf20180303-18878-76biib.rb extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'brew install sqlite3',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
...

but I can run sqlite3 just fine:

[vagrant@nixbox:~/human]$ sqlite3 --version
3.21.0 2017-10-24 18:55:49 1a584e499906b5c87ec7d43d4abce641fdf017c42125b083109bc77c4de48827

How can I get the dev package of sqlite?

kovkev avatar Mar 03 '18 03:03 kovkev

sqlite is a derivation with split outputs, so you probably want to expose sqlite.dev somehow.

endgame avatar Apr 22 '20 01:04 endgame