New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/ydotool: init module #107210
nixos/ydotool: init module #107210
Conversation
123a9db
to
4d01624
Compare
4d01624
to
45e0256
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not create a system user that has access to input and run the service with that user?
I personally have this in my configuration to use ydotool with libinput-gestures:
let
configFile = ...;
in
{
# https://github.com/NixOS/nixpkgs/issues/70471
# Chown&chmod /dev/uinput to owner:root group:input mode:0660
boot.kernelModules = [ "uinput" ];
services.udev.extraRules = ''
SUBSYSTEM=="misc", KERNEL=="uinput", TAG+="uaccess", OPTIONS+="static_node=uinput", GROUP="input", MODE="0660"
'';
users.users.libinput-gestures = {
group = "input";
description = "libinput gestures/gebaard user";
isSystemUser = true;
inherit (config.users.users.nobody) home;
};
systemd.services.libinput-gestures = {
description = "Touchpad gesture listener";
reloadIfChanged = true;
partOf = [ "graphical.target" ];
requires = [ "graphical.target" ];
after = [ "graphical.target" ];
wantedBy = [ "graphical.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.libinput-gestures}/bin/libinput-gestures -c ${configFile}";
#ExecStart = "${pkgs.gebaar-libinput}/bin/gebaard";
#Environment = [ ''"XDG_CONFIG_HOME=${configFile}"'' ];
User = config.users.users.libinput-gestures.name;
Group = config.users.users.libinput-gestures.group;
};
};
}
I marked this as stale due to inactivity. → More info |
I marked this as stale due to inactivity. → More info |
This still needs a daemon. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/1724 |
meta = { | ||
maintainers = with lib.maintainers; [ kimat ]; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meta is always written last in the expression.
ExecStart = "${pkgs.ydotool}/bin/ydotoold"; | ||
Restart = "on-failure"; | ||
}; | ||
wantedBy = [ "default.target" ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wantedBy = [ "default.target" ]; | |
wantedBy = [ "multi-user.target" ]; |
services are almost always put under multi-user.target.
config = mkIf cfg.enable { | ||
systemd.user.services.ydotool = { | ||
description = "Ydotool daemon"; | ||
path = with pkgs; [ ydotool ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tool re-execs itself, right?
wantedBy = [ "default.target" ]; | ||
}; | ||
|
||
environment.systemPackages = [ pkgs.ydotool ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't systemPackages available in the systemd unit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Our systemd
units specify PATH
.
Closing because author did not react in the last year. |
Motivation for this change
ydotool requires a daemon to be started for it to be used:
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)