From 4e10617bc41d7b1f2b5f0f55b60b620dc161bcc5 Mon Sep 17 00:00:00 2001 From: aszlig Date: Fri, 21 Jun 2013 16:15:07 +0200 Subject: [PATCH] winswitch: Basic somewhat working version. Wow, this is one of the most dangerous programs I've seen in a while. It not only tries to probe for a package manager to install dependencies but also tries to execute a whole bunch of programs in $PATH. That's why I decided to override the postFixup phase for now in order to get rid of the current $PATH and meanwhile getting the basics working. So, I'm still not sure how to do the best implementation here on NixOS without allowing winswitch to be too invasive and without restricting it too much so that it's of no use. But let's figure that out once we trimmed down the radiation level of this "living" thing ;-) Signed-off-by: aszlig --- pkgs/tools/X11/winswitch/default.nix | 46 ++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 ++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 pkgs/tools/X11/winswitch/default.nix diff --git a/pkgs/tools/X11/winswitch/default.nix b/pkgs/tools/X11/winswitch/default.nix new file mode 100644 index 00000000000..b53db509daf --- /dev/null +++ b/pkgs/tools/X11/winswitch/default.nix @@ -0,0 +1,46 @@ +{ stdenv, fetchurl, buildPythonPackage, pythonPackages +, which, xpra, xmodmap }: + +let + base = buildPythonPackage rec { + name = "winswitch-${version}"; + namePrefix = ""; + version = "0.12.16"; + + src = fetchurl { + url = "http://winswitch.org/src/${name}.src.tar.bz2"; + sha256 = "0ix122d7rgzdkk70f2q3sd7a4pvyaqsyxkw93pc4zkcg1xh9z3y8"; + }; + + propagatedBuildInputs = with pythonPackages; [ + pygtk twisted pycrypto pyasn1 which xpra xmodmap + ]; + + patchPhase = '' + sed -i -r -e 's|(PREFIX_DIR *= *).*|\1"'"$out"'"|' \ + -e 's|(PREFIX_SEARCH_ORDER *= *).*|\1["'"$out"'"]|' \ + -e 's|(ETC_SEARCH_ORDER *= *).*|\1["'"$out/etc"'"]|' \ + -e 's|(BIN_SEARCH_ORDER *= *).*|\1["'"$out/bin"'"]|' \ + winswitch/util/paths.py + + sed -i -e '/elif *LINUX:/,/distro_helper/{ + s/elif *LINUX:.*/else: name = "NixOS"/p + /distro_helper/!d + }' winswitch/util/distro_packaging_util.py + ''; + + buildPhase = '' + python setup.py build + ''; + + installCommand = '' + PREFIX="$out" python ./setup.py install --prefix="$out" + ''; + + doCheck = false; + }; +in stdenv.lib.overrideDerivation base (b: { + postFixup = b.postFixup + '' + sed -i -e 's/\''${PATH:+:}\$PATH//g' "$out/bin"/* + ''; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c45192bde66..c8acc2c39c7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8395,7 +8395,9 @@ let glSupport = true; }; }; - + + winswitch = callPackage ../tools/X11/winswitch { }; + wings = callPackage ../applications/graphics/wings { erlang = erlangR14B04; esdl = esdl.override { erlang = erlangR14B04; };