1{ buildRubyGem
2, fetchFromGitHub
3, makeWrapper
4, lib
5, bundler
6, nix
7, nix-prefetch-git
8}:
9
10buildRubyGem rec {
11 inherit (bundler) ruby;
12
13 name = "${gemName}-${version}";
14 gemName = "bundix";
15 version = "2.5.2";
16
17 src = fetchFromGitHub {
18 owner = "nix-community";
19 repo = "bundix";
20 rev = version;
21 sha256 = "sha256-QnNdseCSwQYhO/ybzWsflMEk68TMgPU3HqXJ7av3SHE=";
22 };
23
24 buildInputs = [ ruby bundler ];
25 nativeBuildInputs = [ makeWrapper ];
26
27 preFixup = ''
28 wrapProgram $out/bin/bundix \
29 --prefix PATH : "${nix.out}/bin" \
30 --prefix PATH : "${nix-prefetch-git.out}/bin" \
31 --prefix PATH : "${bundler.out}/bin" \
32 --set GEM_HOME "${bundler}/${bundler.ruby.gemPath}" \
33 --set GEM_PATH "${bundler}/${bundler.ruby.gemPath}"
34 '';
35
36 meta = {
37 description = "Creates Nix packages from Gemfiles";
38 longDescription = ''
39 This is a tool that converts Gemfile.lock files to nix expressions.
40
41 The output is then usable by the bundlerEnv derivation to list all the
42 dependencies of a ruby package.
43 '';
44 homepage = "https://github.com/manveru/bundix";
45 license = "MIT";
46 maintainers = with lib.maintainers; [ manveru marsam zimbatm ];
47 platforms = lib.platforms.all;
48 };
49}