HomeManager: service.clipse not working

Hi folks :slight_smile:

I’ve tried to install clipse via HomeManager with the following snippet:

services = {
  clipse = {
    enable = true;
  }
}

However, when i start clipse, it always tells me that there are no entries in the clipboard:

I’ve installed wl-clipboard as it is a dependency of clipse and i’ve made sure to copy something beforehand.

Running systemctl --user list-units | rg clipse gives me this output:

UNIT             LOAD     ACTIVE   SUB      DESCRIPTION
clipse.service   loaded   active   exited   Clipse listener

So it seems to me, that the service was started, but is not running anymore.

strace clipse -listen gives me the following log:

It includes a couple of lines with errors, for e.g.

epoll_ctl(4, EPOLL_CTL_ADD, 7, {events=EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET, data=0x3facc159a300001f}) = -1 EPERM (Operation not permitted)

I’m unfortunately a bit out of my depth here and can’t figure out, what exactly is going wrong.

I’m using Nixpkgs unstable and HomeManager unstable.

Any help woul be highly appreciated!

Cheers!

What about journalctl -e --user --unit clipse?

Output of journalctl -e --user --unit clipse:

Jan 05 08:31:24 nixos systemd[1639]: Starting Clipse listener...
Jan 05 08:31:24 nixos systemd[1639]: Finished Clipse listener.

Hmm, yeah, the home-manager module is using the daemon version of the binary with oneshot, which is why the service is “active” but “exited”. Whoever wrote this module doesn’t know what they’re doing; when you get this to work you can try to fix the module upstream.

For now, I’d suggest adding to your config:

systemd.user.services.clipse.Service = {
  Type = "exec";
  ExecStart = "${lib.getExe config.services.clipse.package} --listen-shell";
}

… though the author seems to suggest that --listen uses nohup; there’s a chance this won’t work simply because of bad stdout/stdin handling, at which point you get to play with more systemd unit settings.

You’ll also have to use uwsm to start your DE, and properly set up systemd variable importing and whatnot.

With that said, digging a little through clipse’s code, I don’t think the author really knows what they’re doing either. I’d suggest finding an alternative that actually targets Linux desktops; this is clearly written primarily for MacOS and the author doesn’t know how a Linux desktop works, leading to all kinds of little integration issues. It seems to me like pretty much everything this service does can be replaced by just reading the wl-clipboard docs for a bit.

2 Likes

Ok i see.. thank you very much for all the helpful information!

I probably won’t be able to fix those integration issues you are talking about, because my nix skills and systemd knowledge are unfortunately lacking. And your last paragraph makes me think, that this might not even be worth the effort.

I manly wanted to try out clipse because it seems to have a nice tui menu, but i guess one should be able to recreate that by piping the output of a clipboard manager to a dmenu equivalent. I will try this instead :slight_smile: