qt: add option qt.systemdServicePath

This option contains a string suitable as value for the PATH
environment variable in systemd services that run Qt 5 applications.

Qt applications need this special treatment because they use PATH to
locate plugins that sometimes are necessary for proper functioning.

For now the option is not visible in the manual since the default
value is expected to work in most, if not all, cases.
This commit is contained in:
Robert Helgesson 2018-06-03 17:32:57 +02:00
parent faf04b009b
commit dc1e9d1bc6
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 19 additions and 3 deletions

View file

@ -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.
'';
};
};
};

View file

@ -33,7 +33,7 @@ in
};
Service = {
Environment = "PATH=%h/.nix-profile/bin";
Environment = "PATH=${config.qt.systemdServicePath}";
ExecStart = "${package}/bin/flameshot";
Restart = "on-abort";
};

View file

@ -18,7 +18,7 @@ with lib;
};
Service = {
Environment = "PATH=%h/.nix-profile/bin";
Environment = "PATH=${config.qt.systemdServicePath}";
ExecStart = "${pkgs.owncloud-client}/bin/owncloud";
};

View file

@ -54,7 +54,7 @@ with lib;
};
Service = {
Environment = "PATH=%h/.nix-profile/bin";
Environment = "PATH=${config.qt.systemdServicePath}";
ExecStart = "${pkgs.qsyncthingtray}/bin/QSyncthingTray";
};