That’s basically what bundlerApp
is for.
You start with the default.nix and Gemfile:
default.nix
with import <nixpkgs> {};
bundlerApp {
pname = "twurl";
exes = ["twurl"];
gemdir = ./.;
}
Gemfile
source 'https://rubygems.org' do
gem 'twurl'
end
After running bundix -l
, you should then have these files in the directory:
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
oauth (0.5.4)
twurl (0.9.3)
oauth (~> 0.4)
PLATFORMS
ruby
DEPENDENCIES
twurl!
BUNDLED WITH
1.16.3
gemset.nix
{
oauth = {
source = {
remotes = ["https://rubygems.org"];
sha256 = "1zszdg8q1b135z7l7crjj234k4j0m347hywp5kj6zsq7q78pw09y";
type = "gem";
};
version = "0.5.4";
};
twurl = {
dependencies = ["oauth"];
source = {
remotes = ["https://rubygems.org"];
sha256 = "10lcdakbgvbwcij8ngxm7vws7b40l004ma4mza9idi54vkxqzaws";
type = "gem";
};
version = "0.9.3";
};
}
Finally a nix build
gives you the result/bin/twurl
executable.
The difference is that bundlerEnv
is for development with these gems, while bundlerApp
simply gives you the executables without need for development dependencies, environment changes, nix-shell, etc…
Hope this helps