1 { config, lib, pkgs, ... }:
4 cfg = config.programs.mouse-actions;
7 options.programs.mouse-actions = {
8 enable = lib.mkEnableOption "" // {
10 Whether to install and set up mouse-actions and it's udev rules.
12 Note that only users in the "uinput" group will be able to use the package
15 package = lib.mkPackageOption pkgs "mouse-actions" {
16 example = "mouse-actions-gui";
18 autorun = lib.mkOption {
19 type = lib.types.bool;
22 Whether to start a user service to run mouse-actions on startup.
26 config = lib.mkIf cfg.enable {
27 environment.systemPackages = [ cfg.package ];
28 services.udev.packages = [ cfg.package ];
29 systemd.user.services.mouse-actions = lib.mkIf cfg.autorun {
30 description = "mouse-actions launcher";
31 wantedBy = [ "graphical-session.target" ];
32 bindsTo = [ "graphical-session.target" ];
33 after = [ "graphical-session.target" ];
34 environment.PATH = lib.mkForce null; # don't use the default PATH provided by NixOS
36 ExecStart = "${lib.getExe cfg.package} start";
37 PassEnvironment = "PATH"; # inherit PATH from user environment