nixos/triggerhappy: add option user

This commit is contained in:
Johannes Frankenau 2018-11-07 13:23:11 +01:00
parent 78090f4f09
commit fab6a4376f

View File

@ -57,6 +57,15 @@ in
''; '';
}; };
user = mkOption {
type = types.str;
default = "nobody";
example = "root";
description = ''
User account under which <command>triggerhappy</command> runs.
'';
};
bindings = mkOption { bindings = mkOption {
type = types.listOf (types.submodule bindingCfg); type = types.listOf (types.submodule bindingCfg);
default = []; default = [];
@ -96,7 +105,7 @@ in
after = [ "local-fs.target" ]; after = [ "local-fs.target" ];
description = "Global hotkey daemon"; description = "Global hotkey daemon";
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.triggerhappy}/bin/thd --user nobody --socket ${socket} --triggers ${configFile} --deviceglob /dev/input/event*"; ExecStart = "${pkgs.triggerhappy}/bin/thd ${optionalString (cfg.user != "root") "--user ${cfg.user}"} --socket ${socket} --triggers ${configFile} --deviceglob /dev/input/event*";
}; };
}; };