NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.18k stars 13.45k forks source link

OpenTabletDriver user service is missing #318274

Open CrumblyLiquid opened 2 months ago

CrumblyLiquid commented 2 months ago

Describe the bug

OpenTabletDriver user service is missing so I have to manually run otd-daemon.

I'm using this in my config:

  hardware.opentabletdriver = {
    enable = true;
    daemon.enable = true;
  };

And yet there is no systemd service:

 ❯ systemctl --user status opentabletdriver.service
Unit opentabletdriver.service could not be found.

systemctl --user --all shows:

  UNIT                          LOAD      ACTIVE   SUB       DESCRIPTION 
● opentabletdriver.service      not-found inactive dead      opentabletdriver.service

My dotfiles for reference: https://github.com/CrumblyLiquid/dotfiles

Steps To Reproduce

Steps to reproduce the behavior:

  1. Use the snippet in your configuration
  2. Open the OpenTabletDriver GUI
  3. The GUI can't connect to the daemon and will time out with Daemon Connection Error: Connecting to daemon has timed out. Verify that OpenTabletDriver.Daemon is running.

Expected behavior

The OTD user service should be present and should automatically start with the DE/WM.

Notify maintainers

@thiagokokada

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.32, NixOS, 24.11 (Vicuña), 24.11.20240605.e8057b6`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/store/8s55w0927lh3mdbkxf434zb0c5hqsz8z-source`

Add a :+1: reaction to issues you find important.

Atemo-C commented 2 months ago

Same thing here. Starting the daemon with otd-daemon after launch of one's desired desktop works, but it should not be needed with the option hardware.opentabletdriver.daemon.enable = true;.

The relevant behaviour of the module is present in this section, notably:

systemd.user.services.opentabletdriver = with pkgs; mkIf cfg.daemon.enable {
    description = "Open source, cross-platform, user-mode tablet driver";
    wantedBy = [ "graphical-session.target" ];
    partOf = [ "graphical-session.target" ];

    serviceConfig = {
        Type = "simple";
        ExecStart = "${cfg.package}/bin/otd-daemon";
        Restart = "on-failure";
    };
};

If this is of any use, I am running on the latest stable release of NixOS (currently 24.05), and I start the Hyprland Wayland compositor from the unstable branch straight from the TTY without a display/login manager.

thiagokokada commented 2 months ago

If this is of any use, I am running on the latest stable release of NixOS (currently 24.05), and I start the Hyprland Wayland compositor from the unstable branch straight from the TTY without a display/login manager.

It is way more likely that you're forgetting to start the graphical-session.target than it being something wrong with the service.

Try to run systemctl start --user graphical-session.target and see if this fixes the issue.

Atemo-C commented 2 months ago

Try to run systemctl start --user graphical-session.target and see if this fixes the issue.

Failed to start graphical-session.target: Operation refused, unit graphical-session.target may be requested by dependency only

thiagokokada commented 2 months ago

Try to run systemctl start --user graphical-session.target and see if this fixes the issue.

Failed to start graphical-session.target: Operation refused, unit graphical-session.target may be requested by dependency only

Generally it is either the Display Manager or you need to trigger the target manually. I don't exactly remember how to do this, but Home-manager has a way to trigger it.

Atemo-C commented 2 months ago

Ah, so it assumes you use a Display/Login manager? I do not really know much about all of this, I am too used to log-in via the TTY and simply type the name of my environment. I will read upon how to trigger it with Home Manager, and I will report back on the results.


[12/06/2024 10:13 UTC] Edit/Update: After having tried a few things unsuccessfully, I searched through issues, and found these two, which are relevant to me:

fufexan commented 2 months ago

@Atemo-C if you're using the Hyprland HM module, it should already start graphical-session.target, by starting hyprland-session.target https://nix-community.github.io/home-manager/options.xhtml#opt-wayland.windowManager.hyprland.systemd.extraCommands

Atemo-C commented 2 months ago

if you're using the Hyprland HM module

Ah. Well, I was not using it. I guess I should do that! I'm surprised it wasn't mentioned in any documentation that choosing this over the regular would offer this by default... Thank you!

fufexan commented 2 months ago

I guess it's time to update the Hyprland wiki.

Atemo-C commented 2 months ago

Just tested, and it does indeed fix the issue. The thing is that one should not have to use the Home Manager module for it to work, but that is a different issue to be reported. Thanks for the help.

thiagokokada commented 2 months ago

Just tested, and it does indeed fix the issue. The thing is that one should not have to use the Home Manager module for it to work, but that is a different issue to be reported. Thanks for the help.

You don't need to use the Home-Manager module but in this case you need to manually trigger the graphical-session.target yourself. From the error you posted above, you probably need to create, e.g.: hyprland.service or target that depends on the graphical-session.target and trigger it at login.

Atemo-C commented 2 months ago

Just tested, and it does indeed fix the issue. The thing is that one should not have to use the Home Manager module for it to work, but that is a different issue to be reported. Thanks for the help.

You don't need to use the Home-Manager module but in this case you need to manually trigger the graphical-session.target yourself. From the error you posted above, you probably need to create, e.g.: hyprland.service or target that depends on the graphical-session.target and trigger it at login.

Yes, and creating it is basically as easy as copying what is made in the Home Manager module, so I am simply going this route.

fufexan commented 2 months ago

The thing is that one should not have to use the Home Manager module for it to work, but that is a different issue to be reported.

If you're talking about a Hyprland issue, we know about this. It's been discussed in https://github.com/hyprwm/Hyprland/pull/5648, until the author decided to close the PR. I will follow up with a fix when I have more free time.

emmanuelrosa commented 2 months ago

I use GDM to log in to Hyprland, and I have the network manager applet and hypridle NixOS modules enabled. However, neither service starts. Both of these modules create a systemd service dependent on the "graphical-session" target.