mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
nixos/mouse-actions: add user service, allow different package
This commit is contained in:
parent
5a22d11cac
commit
1899cb0f36
1 changed files with 33 additions and 7 deletions
|
@ -3,13 +3,39 @@
|
|||
let
|
||||
cfg = config.programs.mouse-actions;
|
||||
in
|
||||
{
|
||||
options.programs.mouse-actions = {
|
||||
enable = lib.mkEnableOption ''
|
||||
mouse-actions udev rules. This is a prerequisite for using mouse-actions without being root
|
||||
{
|
||||
options.programs.mouse-actions = {
|
||||
enable = lib.mkEnableOption "" // {
|
||||
description = ''
|
||||
Whether to install and set up mouse-actions and it's udev rules.
|
||||
|
||||
Note that only users in the "uinput" group will be able to use the package
|
||||
'';
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.udev.packages = [ pkgs.mouse-actions ];
|
||||
package = lib.mkPackageOption pkgs "mouse-actions" {
|
||||
example = "mouse-actions-gui";
|
||||
};
|
||||
}
|
||||
autorun = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to start a user service to run mouse-actions on startup.
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
services.udev.packages = [ cfg.package ];
|
||||
systemd.user.services.mouse-actions = lib.mkIf cfg.autorun {
|
||||
description = "mouse-actions launcher";
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
bindsTo = [ "graphical-session.target" ];
|
||||
after = [ "graphical-session.target" ];
|
||||
environment.PATH = lib.mkForce null; # don't use the default PATH provided by NixOS
|
||||
serviceConfig = {
|
||||
ExecStart = "${lib.getExe cfg.package} start";
|
||||
PassEnvironment = "PATH"; # inherit PATH from user environment
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue