Commit Graph

20 Commits

Author SHA1 Message Date
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