10 python3.pkgs.buildPythonApplication rec {
15 src = fetchFromGitHub {
16 owner = "phillipberndt";
18 rev = "refs/tags/${version}";
19 hash = "sha256-8FMfy3GCN4z/TnfefU2DbKqV3W35I29/SuGGqeOrjNg";
22 nativeBuildInputs = [ installShellFiles desktop-file-utils ];
23 propagatedBuildInputs = with python3.pkgs; [ packaging ];
26 substituteInPlace autorandr.py \
27 --replace 'os.popen("xrandr' 'os.popen("${xrandr}/bin/xrandr' \
28 --replace '["xrandr"]' '["${xrandr}/bin/xrandr"]'
31 patches = [ ./0001-don-t-use-sys.executable.patch ];
33 outputs = [ "out" "man" ];
37 make install TARGETS='autorandr' PREFIX=$out
39 # zsh completions exist but currently have no make target, use
40 # installShellCompletions for both
41 # see https://github.com/phillipberndt/autorandr/issues/197
42 installShellCompletion --cmd autorandr \
43 --bash contrib/bash_completion/autorandr \
44 --zsh contrib/zsh_completion/_autorandr \
45 --fish contrib/fish_completion/autorandr.fish
47 make install TARGETS='autostart_config' PREFIX=$out DESTDIR=$out
49 make install TARGETS='manpage' PREFIX=$man
51 ${if systemd != null then ''
52 make install TARGETS='systemd udev' PREFIX=$out DESTDIR=$out \
53 SYSTEMD_UNIT_DIR=/lib/systemd/system \
54 UDEV_RULES_DIR=/etc/udev/rules.d
55 substituteInPlace $out/etc/udev/rules.d/40-monitor-hotplug.rules \
56 --replace /bin/systemctl "/run/current-system/systemd/bin/systemctl"
58 make install TARGETS='pmutils' DESTDIR=$out \
59 PM_SLEEPHOOKS_DIR=/lib/pm-utils/sleep.d
60 make install TARGETS='udev' PREFIX=$out DESTDIR=$out \
61 UDEV_RULES_DIR=/etc/udev/rules.d
68 homepage = "https://github.com/phillipberndt/autorandr/";
69 description = "Automatically select a display configuration based on connected devices";
70 license = licenses.gpl3Plus;
71 maintainers = with maintainers; [ coroa ];
72 platforms = platforms.unix;
73 mainProgram = "autorandr";