From cd902179db236e3d0ad8326cc08b68f786fc7ab2 Mon Sep 17 00:00:00 2001 From: Jonas Hoersch Date: Wed, 25 Sep 2013 00:10:59 +0200 Subject: [PATCH 1/2] autorandr: add autorandr an automatic display configuration selector --- pkgs/tools/misc/autorandr/default.nix | 34 +++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 5 ++++ 2 files changed, 39 insertions(+) create mode 100644 pkgs/tools/misc/autorandr/default.nix diff --git a/pkgs/tools/misc/autorandr/default.nix b/pkgs/tools/misc/autorandr/default.nix new file mode 100644 index 000000000000..5146be248da0 --- /dev/null +++ b/pkgs/tools/misc/autorandr/default.nix @@ -0,0 +1,34 @@ +{ fetchgit, stdenv, disper ? null, xrandr, xdpyinfo }: + +let + rev = "4f5e2401ef"; +in + stdenv.mkDerivation { + name = "autorandr-${rev}"; + + src = fetchgit { + inherit rev; + url = "https://github.com/wertarbyte/autorandr.git"; + }; + + patchPhase = '' + substituteInPlace "autorandr" \ + --replace "/usr/bin/xrandr" "${xrandr}/bin/xrandr" \ + --replace "/usr/bin/xdpyinfo" "${xdpyinfo}/bin/xdpyinfo" + '' + stdenv.lib.optionalString (disper != null) '' + substituteInPlace "autorandr" + --replace "/usr/bin/disper" "${disper}/bin/disper" + ''; + + installPhase = '' + mkdir -p "$out/etc/bash_completion.d" + cp -v bash_completion/autorandr "$out/etc/bash_completion.d" + mkdir -p "$out/bin" + cp -v autorandr auto-disper $out/bin + ''; + + meta = { + description = "Autorandr, automatic display configuration selector based on connected devices"; + homepage = https://github.com/wertarbyte/autorandr; + }; + } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d162c0b7ceaf..4c9b84581796 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -495,6 +495,11 @@ let autojump = callPackage ../tools/misc/autojump { }; + autorandr = callPackage ../tools/misc/autorandr { + inherit (xorg) xrandr xdpyinfo; + disper = null; + }; + avahi = callPackage ../development/libraries/avahi { qt4Support = config.avahi.qt4Support or false; }; From 683310e05e7eb9351b24e9a824f1fb3bf5ae0c3a Mon Sep 17 00:00:00 2001 From: Jonas Hoersch Date: Thu, 26 Sep 2013 13:12:01 +0200 Subject: [PATCH 2/2] autorandr: make the dependencies on xrandr and disper configurable by enableX params --- pkgs/tools/misc/autorandr/default.nix | 15 ++++++++++----- pkgs/top-level/all-packages.nix | 1 - 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pkgs/tools/misc/autorandr/default.nix b/pkgs/tools/misc/autorandr/default.nix index 5146be248da0..d9a727e8a09d 100644 --- a/pkgs/tools/misc/autorandr/default.nix +++ b/pkgs/tools/misc/autorandr/default.nix @@ -1,4 +1,11 @@ -{ fetchgit, stdenv, disper ? null, xrandr, xdpyinfo }: +{ fetchgit +, stdenv +, enableXRandr ? true, xrandr ? null +, enableDisper ? false, disper ? null +, xdpyinfo }: + +assert enableXRandr -> xrandr != null; +assert enableDisper -> disper != null; let rev = "4f5e2401ef"; @@ -13,11 +20,9 @@ in patchPhase = '' substituteInPlace "autorandr" \ - --replace "/usr/bin/xrandr" "${xrandr}/bin/xrandr" \ + --replace "/usr/bin/xrandr" "${if enableXRandr then xrandr else "/nowhere"}/bin/xrandr" \ + --replace "/usr/bin/disper" "${if enableDisper then disper else "/nowhere"}/bin/disper" \ --replace "/usr/bin/xdpyinfo" "${xdpyinfo}/bin/xdpyinfo" - '' + stdenv.lib.optionalString (disper != null) '' - substituteInPlace "autorandr" - --replace "/usr/bin/disper" "${disper}/bin/disper" ''; installPhase = '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4c9b84581796..b045f2124035 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -497,7 +497,6 @@ let autorandr = callPackage ../tools/misc/autorandr { inherit (xorg) xrandr xdpyinfo; - disper = null; }; avahi = callPackage ../development/libraries/avahi {