From fab6a4376feab71e2a5630df98e6a5b42ac1ffc4 Mon Sep 17 00:00:00 2001 From: Johannes Frankenau Date: Wed, 7 Nov 2018 13:23:11 +0100 Subject: [PATCH] nixos/triggerhappy: add option user --- nixos/modules/services/hardware/triggerhappy.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/hardware/triggerhappy.nix b/nixos/modules/services/hardware/triggerhappy.nix index 81d4a1ae65bf..bffe7353b10e 100644 --- a/nixos/modules/services/hardware/triggerhappy.nix +++ b/nixos/modules/services/hardware/triggerhappy.nix @@ -57,6 +57,15 @@ in ''; }; + user = mkOption { + type = types.str; + default = "nobody"; + example = "root"; + description = '' + User account under which triggerhappy runs. + ''; + }; + bindings = mkOption { type = types.listOf (types.submodule bindingCfg); default = []; @@ -96,7 +105,7 @@ in after = [ "local-fs.target" ]; description = "Global hotkey daemon"; 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*"; }; };