From a1762065c3696530789109d37781dedb0400e140 Mon Sep 17 00:00:00 2001 From: Michael Peyton Jones Date: Thu, 9 Aug 2018 15:17:43 +0100 Subject: [PATCH] redshift: install desktop files, and use absolute paths in them to avoid confusing geoclue agent --- nixos/modules/services/x11/redshift.nix | 3 +++ pkgs/applications/misc/redshift/default.nix | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/nixos/modules/services/x11/redshift.nix b/nixos/modules/services/x11/redshift.nix index 30d853841ea..b7dd7debcb6 100644 --- a/nixos/modules/services/x11/redshift.nix +++ b/nixos/modules/services/x11/redshift.nix @@ -116,6 +116,9 @@ in { } ]; + # needed so that .desktop files are installed, which geoclue cares about + environment.systemPackages = [ cfg.package ]; + services.geoclue2.enable = mkIf (cfg.provider == "geoclue2") true; systemd.user.services.redshift = diff --git a/pkgs/applications/misc/redshift/default.nix b/pkgs/applications/misc/redshift/default.nix index c6d3d6e1a9d..b8c49cb02a6 100644 --- a/pkgs/applications/misc/redshift/default.nix +++ b/pkgs/applications/misc/redshift/default.nix @@ -61,6 +61,15 @@ stdenv.mkDerivation rec { postFixup = "wrapPythonPrograms"; + # the geoclue agent may inspect these paths and expect them to be + # valid without having the correct $PATH set + postInstall = '' + substituteInPlace $out/share/applications/redshift.desktop \ + --replace 'Exec=redshift' "Exec=$out/bin/redshift" + substituteInPlace $out/share/applications/redshift.desktop \ + --replace 'Exec=redshift-gtk' "Exec=$out/bin/redshift-gtk" + ''; + enableParallelBuilding = true; meta = with stdenv.lib; {