about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/misc/sqitch/default.nix
blob: 66d40ae312799b86f2152ebf745303c60f187216 (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
{ name, stdenv, perl, makeWrapper, sqitchModule, databaseModule, shortenPerlShebang }:

stdenv.mkDerivation {
  name = "${name}-${sqitchModule.version}";

  buildInputs = [ perl makeWrapper sqitchModule databaseModule ];

  src = sqitchModule;
  dontBuild = true;

  nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin shortenPerlShebang;

  installPhase = ''
    mkdir -p $out/bin
    for d in bin/sqitch etc lib share ; do
      # make sure dest alreay exists before symlink
      # this prevents installing a broken link into the path
      if [ -e ${sqitchModule}/$d ]; then
        ln -s ${sqitchModule}/$d $out/$d
      fi
    done
  '' + stdenv.lib.optionalString stdenv.isDarwin ''
    shortenPerlShebang $out/bin/sqitch
  '';
  dontStrip = true;
  postFixup = "wrapProgram $out/bin/sqitch --prefix PERL5LIB : $PERL5LIB";

  meta = {
    platforms = stdenv.lib.platforms.unix;
    inherit (sqitchModule.meta) license;
  };
}