Merge pull request #20744 from kampka/python-autorandr

autorandr: 59f6aec0b -> 53d29f9
This commit is contained in:
Jörg Thalheim 2016-12-14 09:50:16 +01:00 committed by GitHub
commit ce31c6b019

View File

@ -1,48 +1,41 @@
{ fetchgit
, stdenv
, enableXRandr ? true, xrandr ? null
, enableDisper ? true, disper ? null
, python
, xdpyinfo }:
assert enableXRandr -> xrandr != null;
assert enableDisper -> disper != null;
, python3Packages
, fetchFromGitHub }:
let
# Revision and date taken from the legacy tree, which still
# supports disper:
# https://github.com/phillipberndt/autorandr/tree/legacy
rev = "59f6aec0bb72e26751ce285d079e085b7178e45d";
date = "20150127";
python = python3Packages.python;
wrapPython = python3Packages.wrapPython;
date = "2016-11-23";
in
stdenv.mkDerivation {
name = "autorandr-${date}";
name = "autorandr-unstable-${date}";
src = fetchgit {
inherit rev;
url = "https://github.com/phillipberndt/autorandr.git";
sha256 = "0mnggsp42477kbzwwn65gi8y0rydk10my9iahikvs6n43lphfa1f";
};
buildInputs = [ python wrapPython ];
patchPhase = ''
substituteInPlace "autorandr" \
--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" \
--replace "which xxd" "false" \
--replace "python" "${python}/bin/python"
'';
phases = [ "unpackPhase" "installPhase" ];
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
# install bash completions
mkdir -p $out/bin $out/libexec $out/etc/bash_completion.d
cp -v contrib/bash_completion/autorandr $out/etc/bash_completion.d
# install autorandr bin
cp autorandr.py $out/bin/autorandr
wrapPythonProgramsIn $out/bin/autorandr $out
'';
src = fetchFromGitHub {
owner = "phillipberndt";
repo = "autorandr";
rev = "53d29f99275aebf14240ea95f2d7022b305738d5";
sha256 = "0pza4wfkzv7mmg2m4pf3n8wk0p7cy6bfqknn8ywz51r8ja16cqfj";
};
meta = {
description = "Automatic display configuration selector based on connected devices";
homepage = https://github.com/wertarbyte/autorandr;
homepage = "http://github.com/phillipberndt/autorandr/";
description = "Auto-detect the connect display hardware and load the appropiate X11 setup using xrandr";
license = stdenv.lib.licenses.gpl3Plus;
maintainers = [ stdenv.lib.maintainers.coroa ];
platforms = stdenv.lib.platforms.unix;
};