summary refs log tree commit diff
path: root/pkgs/development/interpreters/ruby/bundix/default.nix
blob: 245090e66e1acc465e417c76d903316c125236aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ buildRubyGem, lib, bundler, ruby, nix, nix-prefetch-scripts }:

buildRubyGem rec {
  inherit ruby;

  name = "${gemName}-${version}";
  gemName = "bundix";
  version = "2.0.5";

  sha256 = "0bsynhr44jz6nih0xn7v32h1qvywnb5335ka208gn7jp6bjwabhy";

  buildInputs = [bundler];

  postInstall = ''
    gem_root=$GEM_HOME/gems/${gemName}-${version}
    sed \
      -e 's|NIX_INSTANTIATE =.*|NIX_INSTANTIATE = "${nix}/bin/nix-instantiate"|' \
      -i $gem_root/lib/bundix.rb
    sed \
      -e 's|NIX_HASH =.*|NIX_HASH = "${nix}/bin/nix-hash"|' \
      -i $gem_root/lib/bundix.rb
    sed \
      -e 's|NIX_PREFETCH_URL =.*|NIX_PREFETCH_URL = "${nix}/bin/nix-prefetch-url"|' \
      -i $gem_root/lib/bundix.rb
    sed \
      -e 's|NIX_PREFETCH_GIT =.*|NIX_PREFETCH_GIT = "${nix-prefetch-scripts}/bin/nix-prefetch-git"|' \
      -i $gem_root/lib/bundix.rb
  '';

  meta = {
    inherit version;
    description = "Creates Nix packages from Gemfiles";
    longDescription = ''
      This is a tool that converts Gemfile.lock files to nix expressions.

      The output is then usable by the bundlerEnv derivation to list all the
      dependencies of a ruby package.
    '';
    homepage = "https://github.com/manveru/bundix";
    license = "MIT";
    maintainers = with lib.maintainers; [ manveru zimbatm ];
    platforms = lib.platforms.all;
  };
}