-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
espanso: add sandboxing for systemd service #5957
base: master
Are you sure you want to change the base?
Conversation
f1dc88d
to
ff2f6b3
Compare
Have you tested on Wayland by chance? Might be tricky since it's not working as is on nixos. @pitkling and I have an ongoing discussion on the best way to manage the capabilities that are required for the evdev backend, in the context of espanso's forking and good faith effort to drop capabilities as early as possible. We have a couple open PRs, and I'm particularly interested in compatibility of these systemd changes with his PR, which I think is what we'll eventually go with for Wayland compatibility. |
This systemd service config is what I have been using on GNOME with Wayland for the last couple of months. I wanted to upstream this config so that others may benefit too. However, for posterity, it should be noted that I use services.espanso.package = pkgs.espanso-wayland; |
Interesting. I haven't been able to get espanso to work on Wayland without |
Ahh, you're right. I'm sorry, I forgot about the I ran the command as mentioned in https://espanso.org/docs/install/linux#adding-the-required-capabilities But, please feel free to correct me if I'm wrong, I don't think this is within the scope of home-manager—changes like capabilities are not a part of home-manager, right? For example, some packages require adding a udev rule and so they end up adding a new file under |
No, you're completely right, the problem @n8henrie is referring to cannot be fixed by Home Manager. But we have some PRs in NixOS (namely #328890 and #339594 ) that try to fix the Wayland issue. The I assume @n8henrie mostly was curious about the compatibility of your PR with those fixes. Since the Wayland issues are related to capabilities, sandboxing is likely to affect them. I tried your PR together with my PR #328890 for the Wayland issue and indeed I ran into some problems due to the sandboxing. I did only some very quick testing so far. I expected that something like I didn't yet test @n8henrie's PR #339594 together with your PR. It should involve changing the Home Manager service to also run |
I see. Since I'm using home-manager with Fedora (GNOME Wayland), I was able to use the In the meantime, I'll just continue to use |
Thanks for the elaboration @pitkling, spot on. Sorry, traveling / on mobile. |
@talal I looked further into this on my system, and even with the unmodified espanso-wayland package (version 2.2.1, from nixpkgs-unstable) the sandboxing options cause problems for me. More exactly, I did the following:
Starting the espanso user service now fails, with the logs mentioning permissions problems. If I remove the sandboxing options from the user service file and reload the service, everything works fine. Could you possibly post the output of
(showing the log output of the last invocation of the espanso user service)? Maybe I can find a hint why the sandboxing works on your system but not on mine. |
|
Thanks @talal, that helped a lot! Your espanso log indicates that the capabilities you granted via I tested this locally by adding myself to the input group (and temporarily changing the group/access rights of Now, if I'm right then it might be difficult to add sandboxing to the service, at least in the case of espanso-wayland. Not only mine but also @n8henrie's NixOS PR #339594 does not work with your sandboxing options. I don't understand it enough to be sure, but the documentation of |
You're right, I forgot about the
|
Ok, that explains why your espanso service had access to the input devices, thanks! 🙂 Unfortunately it seems sandboxing an espanso-wayland user service via Home Manager won't be possible without extra intervention on the system level (via the NixOS configuration or manual Concerning the compatibility of this with the NixOS PRs #328890 and #339594: Any solution based on
Footnotes
|
040a06a
to
dfda5c3
Compare
dfda5c3
to
0678a95
Compare
@rycee Since sandboxing for Espanso is tricky and requires further investigation. I've removed non-sandboxing changes from this PR and cherry-picked them into a separate PR (#5975) — this way they won't get blocked and can be merged independently. @n8henrie @pitkling feel free to add to this PR or close it if sandboxing doesn't work out. |
Description
Checklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
ornix develop --ignore-environment .#all
using Flakes.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Maintainer CC
@n8henrie @lucasew @liyangau