From b00839299f14d6965318a3f72f42a2dd65d6b2bd Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 18 Jan 2008 10:29:58 +0000 Subject: [PATCH] * makeWrapper: new function that transparently takes care of creating a wrapper script. E.g. wrapProgram $out/bin/prog --set FOO bar will create a wrapper around "prog" so that the environment variable FOO is set to bar. The original program is renamed to $out/bin/.wrapped-prog. * Function makeSetupHook to convert a script into a setup hook which can be included in buildInputs. This makes it easier to use scripts like makeWrapper. * Added Bazaar, yet another distributed version management system. svn path=/nixpkgs/trunk/; revision=10211 --- .../version-management/bazaar/default.nix | 22 +++++++++++++++++++ .../make-wrapper/make-wrapper.sh | 8 +++++++ pkgs/top-level/all-packages.nix | 12 ++++++++++ 3 files changed, 42 insertions(+) create mode 100644 pkgs/applications/version-management/bazaar/default.nix diff --git a/pkgs/applications/version-management/bazaar/default.nix b/pkgs/applications/version-management/bazaar/default.nix new file mode 100644 index 000000000000..d64bd60bfd2a --- /dev/null +++ b/pkgs/applications/version-management/bazaar/default.nix @@ -0,0 +1,22 @@ +{stdenv, fetchurl, python, makeWrapper}: + +stdenv.mkDerivation { + name = "bazaar-1.1"; + + src = fetchurl { + url = file:///home/eelco/Downloads/bzr-1.1.tar.gz; + sha256 = "1qpkw580r22yxybdghx2ha0kyk22brbhd1kg9wwjh209dqy2gqzc"; + }; + + buildInputs = [python makeWrapper]; + + installPhase = '' + python setup.py install --prefix=$out + wrapProgram $out/bin/bzr --prefix PYTHONPATH : "$(toPythonPath $out)" + ''; + + meta = { + homepage = http://bazaar-vcs.org/; + description = "A distributed version control system that Just Works"; + }; +} diff --git a/pkgs/build-support/make-wrapper/make-wrapper.sh b/pkgs/build-support/make-wrapper/make-wrapper.sh index 847db8910fd5..b9ed4c54acff 100644 --- a/pkgs/build-support/make-wrapper/make-wrapper.sh +++ b/pkgs/build-support/make-wrapper/make-wrapper.sh @@ -72,3 +72,11 @@ filterExisting() { fi done } + +# Syntax: wrapProgram +wrapProgram() { + local prog="$1" + local hidden="$(dirname "$prog")/.wrapped-$(basename "$prog")" + mv $prog $hidden + makeWrapper $hidden $prog "$@" +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 304444730689..bb4f895b3370 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -288,8 +288,15 @@ rec { inherit stdenv curl; }); + makeSetupHook = script: runCommand "hook" {} '' + ensureDir $out/nix-support + cp ${script} $out/nix-support/setup-hook + ''; + makeWrapper = ../build-support/make-wrapper/make-wrapper.sh; + makeWrapperNew = makeSetupHook ../build-support/make-wrapper/make-wrapper.sh; + # Run the shell command `buildCommand' to produce a store object # named `name'. The attributes in `env' are added to the # environment prior to running the command. @@ -3807,6 +3814,11 @@ rec { inherit fetchurl stdenv unzip; }; + bazaar = import ../applications/version-management/bazaar { + inherit fetchurl stdenv python; + makeWrapper = makeWrapperNew; + }; + # commented out because it's using the new configuration style proposal which is unstable #biew = import ../applications/misc/biew { # inherit lib stdenv fetchurl ncurses;