Skip to content

Instantly share code, notes, and snippets.

@voanhduy1512
Last active July 18, 2019 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voanhduy1512/c7c33225a32145bd4fa46c426934d453 to your computer and use it in GitHub Desktop.
Save voanhduy1512/c7c33225a32145bd4fa46c426934d453 to your computer and use it in GitHub Desktop.
Overwrite bundler in nixpkgs on MacOS
{ buildRubyGem, makeWrapper, ruby, coreutils }:
buildRubyGem rec {
inherit ruby;
name = "${gemName}-${version}";
gemName = "bundler";
version = "2.0.2";
source.sha256 = "1l5203dhf51dnchrd2lxlvqgikx763jz323imhrbhwm0x3yf2ajc";
dontPatchShebangs = true;
postFixup = ''
sed -i -e "s/activate_bin_path/bin_path/g" $out/bin/bundle
'';
}
let
bundlerOverlay = self: super: rec {
bundler = super.callPackage ./bundler.nix {};
};
pkgs = import <nixpkgs> { overlays = [bundlerOverlay]; };
in
with pkgs;
stdenv.mkDerivation rec {
name = "env";
buildInputs = [
ruby
bundix
];
}
[nix-shell:~/Projects/learn_nix]$ bundle --version
Bundler version 2.0.2
[nix-shell:~/Projects/learn_nix]$ bundix --version
Traceback (most recent call last):
8: from /nix/store/dzyrq31c6f9hk7nhcz1avyw1f827v5w2-bundix-2.4.2/bin/.bundix-wrapped:18:in `<main>'
7: from /nix/store/phsfraakzj9wssr6qjgjkj4lgnw98k06-ruby-2.5.5/lib/ruby/2.5.0/rubygems.rb:304:in `activate_bin_path'
6: from /nix/store/phsfraakzj9wssr6qjgjkj4lgnw98k06-ruby-2.5.5/lib/ruby/2.5.0/rubygems.rb:304:in `synchronize'
5: from /nix/store/phsfraakzj9wssr6qjgjkj4lgnw98k06-ruby-2.5.5/lib/ruby/2.5.0/rubygems.rb:305:in `block in activate_bin_path'
4: from /nix/store/phsfraakzj9wssr6qjgjkj4lgnw98k06-ruby-2.5.5/lib/ruby/2.5.0/rubygems/specification.rb:1440:in `activate'
3: from /nix/store/phsfraakzj9wssr6qjgjkj4lgnw98k06-ruby-2.5.5/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `activate_dependencies'
2: from /nix/store/phsfraakzj9wssr6qjgjkj4lgnw98k06-ruby-2.5.5/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `each'
1: from /nix/store/phsfraakzj9wssr6qjgjkj4lgnw98k06-ruby-2.5.5/lib/ruby/2.5.0/rubygems/specification.rb:1469:in `block in activate_dependencies'
/nix/store/phsfraakzj9wssr6qjgjkj4lgnw98k06-ruby-2.5.5/lib/ruby/2.5.0/rubygems/dependency.rb:312:in `to_specs': Could not find 'bundler' (~> 1.11) - did find: [bundler-2.0.2] (Gem::MissingSpecVersionError)
Checked in 'GEM_PATH=/nix/store/q3r2srizfwwzp5sr4vks9gxkvrfammiq-bundler-2.0.2/lib/ruby/gems/2.5.0:/nix/store/dzyrq31c6f9hk7nhcz1avyw1f827v5w2-bundix-2.4.2/lib/ruby/gems/2.5.0:/nix/store/phsfraakzj9wssr6qjgjkj4lgnw98k06-ruby-2.5.5/lib/ruby/gems/2.5.0', execute `gem env` for more information
$ nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
"19.09pre185424.5bcc6cecb35"
@voanhduy1512
Copy link
Author

voanhduy1512 commented Jul 18, 2019

try

let
  bundlerOverlay = self: super: rec {
    bundler = super.callPackage ./bundler.nix {};
    bundix = super.bundix.override { bundler = bundler; };
  };
  pkgs = import <nixpkgs> { overlays =  [bundlerOverlay]; };
in 
  with pkgs;
  stdenv.mkDerivation rec {
    name = "env";
    buildInputs = [
      bundler
      bundix
  ];
}

Same problem

@voanhduy1512
Copy link
Author

voanhduy1512 commented Jul 18, 2019

try

let
  bundlerOverlay = self: super: rec {
    bundler = super.callPackage ./bundler.nix {};
    bundix = super.bundix.override { bundler = super.bundler; };
  };
  pkgs = import <nixpkgs> { overlays =  [bundlerOverlay]; };
in 
  with pkgs;
  stdenv.mkDerivation rec {
    name = "env";
    buildInputs = [
      bundler
      bundix
  ];
}

Actually doesn't fix

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