launchd: allow string entries for serviceOptions.path

Fixes evaluation of khd.
This commit is contained in:
Daiderd Jordan 2017-05-14 00:03:49 +02:00
parent e9cf765076
commit a4eb645d0d
No known key found for this signature in database
GPG key ID: D02435D05B810C96
3 changed files with 11 additions and 8 deletions

View file

@ -32,8 +32,7 @@ in {
}; };
environment.systemPath = mkOption { environment.systemPath = mkOption {
type = types.loeOf types.path; type = types.loeOf types.str;
default = cfg.profiles ++ [ "/usr/local" "/usr" "" ];
description = "The set of paths that are added to PATH."; description = "The set of paths that are added to PATH.";
apply = x: if isList x then makeBinPath x else x; apply = x: if isList x then makeBinPath x else x;
}; };
@ -113,6 +112,8 @@ in {
config = { config = {
environment.systemPath = cfg.profiles ++ [ "/usr/local" "/usr" "" ];
environment.profiles = environment.profiles =
[ # Use user, default and system profiles. [ # Use user, default and system profiles.
"$HOME/.nix-profile" "$HOME/.nix-profile"

View file

@ -14,6 +14,8 @@ let
launchdConfig = import ./launchd.nix; launchdConfig = import ./launchd.nix;
makeDrvBinPath = ps: concatMapStringsSep ":" (p: if isDerivation p then "${p}/bin" else p) ps;
serviceOptions = serviceOptions =
{ config, name, ... }: { config, name, ... }:
let let
@ -33,15 +35,14 @@ let
}; };
path = mkOption { path = mkOption {
type = types.listOf types.path; type = types.loeOf (types.either types.path types.str);
default = []; default = [];
apply = ps: "${makeBinPath ps}";
description = '' description = ''
Packages added to the service's <envar>PATH</envar> Packages added to the service's <envar>PATH</envar>
environment variable. Both the <filename>bin</filename> environment variable. Only the <filename>bin</filename>
and <filename>sbin</filename> subdirectories of each and subdirectories of each package is added.
package are added.
''; '';
apply = ps: if isList ps then (makeDrvBinPath ps) else ps;
}; };
command = mkOption { command = mkOption {

View file

@ -21,6 +21,7 @@ in
package = mkOption { package = mkOption {
type = types.path; type = types.path;
default = pkgs.khd; default = pkgs.khd;
defaultText = "pkgs.khd";
description = "This option specifies the khd package to use."; description = "This option specifies the khd package to use.";
}; };
@ -30,7 +31,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
launchd.user.agents.khd = { launchd.user.agents.khd = {
path = [ cfg.package pkgs.kwm "${config.environment.systemPath}:" ]; path = [ cfg.package pkgs.kwm config.environment.systemPath ];
serviceConfig.Program = "${cfg.package}/bin/khd"; serviceConfig.Program = "${cfg.package}/bin/khd";
serviceConfig.KeepAlive = true; serviceConfig.KeepAlive = true;
serviceConfig.ProcessType = "Interactive"; serviceConfig.ProcessType = "Interactive";