Commit Graph

26 Commits

Author SHA1 Message Date
Michael Fellinger
b285fa07d5
set GEM_HOME via Gem.paths 2020-04-06 15:31:18 +02:00
Michael Fellinger
a2e73b062a
bundler: 1.17.3 -> 2.1.4 2020-04-03 23:52:14 +02:00
talyz
affcf9ba1e bundlerEnv: Add option to copy gem files instead of symlinking
The way ruby loads gems and keeps track of their paths seems to not
always work very well when the gems are accessed through
symlinks. Ruby will then complain that the same files are loaded
multiple times; it relies on the file's full path to determine whether
the file is loaded or not.

This adds an option to simply copy all gem files into the environment
instead, which gets rid of this issue, but may instead result in major
file duplication.
2020-03-03 21:19:01 +01:00
Alyssa Ross
106d0920d9
bundlerEnv: fix for Ruby 2.7
Setting a Bundler version with GEM_PATH doesn't seem to work in Ruby
2.7, so we need to use the LOAD_PATH instead.  Without this,
bundlerEnv environments will always use the version of Bundler that
comes with Ruby, which won't necessarily work because it isn't the
version that was used to generate the bundle.

For example, building ronn with Ruby 2.7 without this change results
in a broken executable, but it works (when built with all packaged
Ruby versions) after this change.
2019-12-26 15:49:04 +00:00
volth
35d68ef143 treewide: remove redundant quotes 2019-08-26 21:40:19 +00:00
volth
f3282c8d1e treewide: remove unused variables (#63177)
* treewide: remove unused variables

* making ofborg happy
2019-06-16 19:59:05 +00:00
Alyssa Ross
26053cae74
bundlerEnv: always include default gems
"default" isn't really a group, it's more the absence of one. With
Bundler, this means that a gem should be installed unconditionally,
regardless of which groups are specified. It doesn't really make sense
to allow these gems to be omitted from a bundlerEnv.
2018-12-11 21:26:09 +00:00
Alyssa Ross
83a2d993d4
bundlerEnv: include all groups by default
This wasn't really an issue until the latest minor release of Bundix
(2.4), because prior to then Bundix didn't emit group attributes, and so
this functionality of bundlerEnv wasn't really used. However, it is now
apparent that a better default for bundlerEnv would be to include all
gem groups by default, not just the default group. This matches the
behavior of Bundler, and makes more sense, because the default group
alone isn't necessarily useful for anything -- consider a Rails app with
production, development, and test groups. It has the additional benefit
of being backwards compatible with how this would have worked before the
Bundix update.
2018-12-11 21:26:08 +00:00
Alyssa Ross
67b1265fb3
bundlerEnv: ensure dependencies always included
Suppose I have a Gemfile like this:

    source "https://rubygems.org"
    gem "actioncable"
    gem "websocket-driver", group: :test

The gemset.nix generated by Bundix 2.4.1 will set ActionCable's groups
to [ "default" ], and websocket-driver's to [ "test" ]. This means that
the generated bundlerEnv wouldn't include websocket-driver unless the
test group was included, even though it's required by the default group.

This is arguably a bug in Bundix (websocket-driver's groups should
probably be [ "default" "test" ] or just [ "default" ]), but there's no
reason bundlerEnv should omit dependencies even given such an input --
it won't necessarily come from Bundix, and it would be good for
bundlerEnv to do the right thing.

To fix this, filterGemset is now a recursive function, that adds
dependencies of gems in the group to the filtered gemset until it
stabilises on the gems that match the required groups, and all of their
recursive dependencies.
2018-12-11 21:26:07 +00:00
Judson Lester
2d5bd339da Bugfix: gemsets didn't handle paths correctly (#51002) 2018-11-25 13:38:38 +01:00
Alyssa Ross
69dcb1a2c0 bundlerApp: take buildInputs (#45435)
It would be reasonable to have a Ruby program that depends on some other
program being in the PATH. In this case, the obvious thing to do would
be something like this:

    bundlerApp {
      # ...
      buildInputs = [ makeWrapper ];
      postBuild = ''
        wrapProgram "$out/bin/foo" \
          --prefix PATH : ${lib.makeBinPath [ dep ]}
      '';
    }

However, this doesn't work, because even though it just forwards most of
its arguments to `runCommand`, `bundlerApp` won't take a `buildInputs`
parameter. It doesn't even specify its own `buildInputs`, which means
that the `scripts` parameter to `bundlerApp` (which depends on
`makeWrapper`) is completely broken, and, as far as I can tell, has been
since its inception. I've added a `makeWrapper` build input if the
scripts parameter is present to fix this.

I've added a `buildInputs` option to `bundlerApp`. It's also passed
through to bundled-common because `postBuild` scripts are run there as
well. This actually means that in this example we'd end up going through
two layers of wrappers (one from `bundlerApp` and one from
bundled-common), but that has always been the case and isn't likely to
break anything. That oddity does suggest that it might be prudent to
not forward `postBuild` to bundled-common (or to at least use a
different option) though...

FWIW, as far as I can tell no package in nixpkgs uses either the
`scripts` or `postBuild` options to `bundlerApp`.
2018-10-29 22:39:51 +01:00
volth
dda95bae35 [bot] treewide: remove unused 'args@' in lambdas 2018-07-20 19:54:05 +00:00
Raitis Veinbahs
a6a2e75804 ruby-modules: Import gemset if it's a path OR a string. (#38959)
This fixes the bug introduced by 8686b98612 which broke bundlerEnv
exprs when gemdir was a string (thus making gemset a string by
`gemset = gemdir + "/gemset.nix"`) which made it being treated as a
set.
2018-04-15 11:53:15 +01:00
Aneesh Agrawal
36f1bcbeb8 ruby treewide: don't merge source into top-level
Keep the `source` attrset distinct to prevent its entries from merging
with the top level attrs.
Since each type of source has a different set of entries for `source`,
this is the easiest way to keep them together.
This will pave the way for a new `url` type of source.

This is a mass-rebuild of many ruby packages,
notably those using `git` type sources.
2018-01-04 02:28:33 -05:00
Aneesh Agrawal
8686b98612 ruby-modules: Allow overriding gemset
This allows patching the gemset output by bundix from a default.nix
file, making it easier to perform updates since the bundix update no
longer has to be manually updated.
2018-01-04 02:28:33 -05:00
Michael Fellinger
d36a83a784 bundlerEnv: support unicode executables (#31145) 2017-11-03 11:31:16 +00:00
Robin Gloster
0154d1b03f
fix evaluation
cc @nyarly
2017-07-30 00:03:24 +02:00
Judson
0641253ae6
Small changes in response to review. 2017-07-02 17:18:58 -07:00
Judson
e149f02344
Using pname and fetching versions 2017-06-27 22:33:18 -07:00
Judson
70e7e543c5
A few cleanups and renames. One feature remains... 2017-06-27 10:56:36 -07:00
Judson
603e84caef
Fixing an overload of "pname" 2017-06-25 17:40:22 -07:00
Judson
964d9b7a06
Made gemdir handling into a common function 2017-06-09 09:04:33 -07:00
Judson
0bde4071fc
Merge branch 'bundlerenv_usecases' of github.com:nyarly/nixpkgs into bundlerenv_usecases 2017-05-31 09:53:03 -07:00
Judson
c4fc70f53c
Starting to add tool builder. Extracting bundler file computation. 2017-05-31 09:44:46 -07:00
zimbatm
2b7cfdd6e9 fix missing variable in bundler-env 2017-05-29 13:27:41 +01:00
Judson
998d011e42
Restructuring files 2017-05-27 15:19:34 -07:00