diff --git a/modules/misc/qt.nix b/modules/misc/qt.nix index c644c704..e366d504 100644 --- a/modules/misc/qt.nix +++ b/modules/misc/qt.nix @@ -24,6 +24,22 @@ in settings. ''; }; + + systemdServicePath = mkOption { + type = types.envVar; + default = lib.makeSearchPath "bin" [ + "/etc/profiles/per-user/%u" + "%h/.nix-profile" + "/nix/var/nix/profiles/default" + "/run/current-system/sw" + ]; + visible = false; + description = '' + Path to use for systemd services that run Qt 5 applications. + This is to ensure that the application is able to locate any + necessary Qt plugins. + ''; + }; }; }; diff --git a/modules/services/flameshot.nix b/modules/services/flameshot.nix index 7c259d43..85f0fa36 100644 --- a/modules/services/flameshot.nix +++ b/modules/services/flameshot.nix @@ -33,7 +33,7 @@ in }; Service = { - Environment = "PATH=%h/.nix-profile/bin"; + Environment = "PATH=${config.qt.systemdServicePath}"; ExecStart = "${package}/bin/flameshot"; Restart = "on-abort"; }; diff --git a/modules/services/owncloud-client.nix b/modules/services/owncloud-client.nix index 353e0136..9c90aff0 100644 --- a/modules/services/owncloud-client.nix +++ b/modules/services/owncloud-client.nix @@ -18,7 +18,7 @@ with lib; }; Service = { - Environment = "PATH=%h/.nix-profile/bin"; + Environment = "PATH=${config.qt.systemdServicePath}"; ExecStart = "${pkgs.owncloud-client}/bin/owncloud"; }; diff --git a/modules/services/syncthing.nix b/modules/services/syncthing.nix index 11511725..2a3de135 100644 --- a/modules/services/syncthing.nix +++ b/modules/services/syncthing.nix @@ -54,7 +54,7 @@ with lib; }; Service = { - Environment = "PATH=%h/.nix-profile/bin"; + Environment = "PATH=${config.qt.systemdServicePath}"; ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray"; };