# Pastebin s69EvABJ let pkgs = import {}; # see description of extraPlugins postgresqlAndPlugins = pg: extraPlugins: pkgs.buildEnv { name = "postgresql-and-plugins-${(builtins.parseDrvName pg.name).version}"; paths = [ pg pg.lib ] ++ extraPlugins; buildInputs = [ pkgs.makeWrapper ]; postBuild = '' mkdir -p $out/bin rm $out/bin/{pg_config,postgres,pg_ctl} cp --target-directory=$out/bin ${pg}/bin/{postgres,pg_config,pg_ctl} wrapProgram $out/bin/postgres --set NIX_PGLIBDIR $out/lib ''; }; stdenv = pkgs.stdenv; inputs = [ pkgs.nodejs-6_x pkgs.gmp pkgs.zlib.dev pkgs.zlib.out pkgs.pkgconfig (postgresqlAndPlugins pkgs.postgresql [pkgs.plv8]) ]; in rec { devEnv = stdenv.mkDerivation rec { name = "dev-env"; buildInputs = inputs; }; }