diff --git a/pkgs/development/tools/misc/sqitch/default.nix b/pkgs/development/tools/misc/sqitch/default.nix index 66d40ae31279..5e3c3bc37c64 100644 --- a/pkgs/development/tools/misc/sqitch/default.nix +++ b/pkgs/development/tools/misc/sqitch/default.nix @@ -1,32 +1,46 @@ -{ name, stdenv, perl, makeWrapper, sqitchModule, databaseModule, shortenPerlShebang }: +{ stdenv +, lib +, perlPackages +, makeWrapper +, shortenPerlShebang +, mysqlSupport ? false +, postgresqlSupport ? false +}: + +let + sqitch = perlPackages.AppSqitch; + modules = with perlPackages; [ ] + ++ lib.optional mysqlSupport DBDmysql + ++ lib.optional postgresqlSupport DBDPg; +in stdenv.mkDerivation { - name = "${name}-${sqitchModule.version}"; + pname = "sqitch"; + version = sqitch.version; - buildInputs = [ perl makeWrapper sqitchModule databaseModule ]; + nativeBuildInputs = [ makeWrapper ] ++ lib.optional stdenv.isDarwin shortenPerlShebang; - src = sqitchModule; + src = sqitch; 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 + if [ -e ${sqitch}/$d ]; then + ln -s ${sqitch}/$d $out/$d fi done - '' + stdenv.lib.optionalString stdenv.isDarwin '' + '' + lib.optionalString stdenv.isDarwin '' shortenPerlShebang $out/bin/sqitch ''; dontStrip = true; - postFixup = "wrapProgram $out/bin/sqitch --prefix PERL5LIB : $PERL5LIB"; + postFixup = '' + wrapProgram $out/bin/sqitch --prefix PERL5LIB : ${perlPackages.makeFullPerlPath modules} + ''; meta = { - platforms = stdenv.lib.platforms.unix; - inherit (sqitchModule.meta) license; + inherit (sqitch.meta) description homepage license platforms; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f0c412e5c9bd..75205bde5de2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16803,17 +16803,13 @@ in perlcritic = perlPackages.PerlCritic; - sqitchMysql = callPackage ../development/tools/misc/sqitch { - name = "sqitch-mysql"; - databaseModule = perlPackages.DBDmysql; - sqitchModule = perlPackages.AppSqitch; - }; + sqitchMysql = (callPackage ../development/tools/misc/sqitch { + mysqlSupport = true; + }).overrideAttrs (oldAttrs: { pname = "sqitch-mysql"; }); - sqitchPg = callPackage ../development/tools/misc/sqitch { - name = "sqitch-pg"; - databaseModule = perlPackages.DBDPg; - sqitchModule = perlPackages.AppSqitch; - }; + sqitchPg = (callPackage ../development/tools/misc/sqitch { + postgresqlSupport = true; + }).overrideAttrs (oldAttrs: { pname = "sqitch-pg"; }); ### DEVELOPMENT / R MODULES