nix-community / nixpkgs-wayland

Automated, pre-built packages for Wayland (sway/wlroots) tools for NixOS. [maintainers=@colemickens, @Artturin]
510 stars 47 forks source link

Sway doesn't pick up extra session commands #285

Closed pimeys closed 3 years ago

pimeys commented 3 years ago

Yesterday I was playing with this overlay, and got everything installed... just to find out a few problems:

1) Should this package be able to use the extraSessionCommands setting? When I upgraded to the unstable sway, whatever is in the variable are not picked up by sway anymore. 1) Should clipboard be working? It works just great with the same config using packages from nixpkgs unstable, but when using this overlay, clipboard between apps just doesn't work anymore.

My config is here.

berbiche commented 3 years ago

The unwrapped sway package in NixOS doesn't handle extraSessionCommands. The Sway package made available here is an unwrapped Sway package.

If you are not using NixOS' programs.sway option, you can make a Sway derivation like so: pkgs.sway.override { sway-unwrapped = sway-unwrapped-from-this-overlay; }.

pimeys commented 3 years ago

Also with the override, if the extraSessionCommands or clipboard are not really working. Could we maybe have the wrapped package also? Would be nice to try the sway master every now and then by just dropping it in to an existing nix config. There are cases when stable is enough, and cases when you need to try out certain things from the trunk.

berbiche commented 3 years ago

I use the 'master' version of Sway without any issue or .override logic. When using this as an overlay, it replaces the sway-unwrapped package and it is automatically picked up by the "wrapped" Sway package.

pimeys commented 3 years ago

Yeah, exactly what I tried too. The extra env vars were not set anymore when logging in again, and for some reason copy&paste didn't work either. Maybe I still missed something?

colemickens commented 3 years ago

Try dropping the change to home.nix. It's not necessary since sway-unwrapped is already replaced by nature of using the overlay.

Also, you don't need waylandPkgs in your config. They're exposed as top level attributes in the pkgs space as well, but I also use waylandPkgs to bundle them and build them as a group (for CI, etc). This just leaks through when the overlay is used (I've tried to avoid it for cleanliness but it was challenging).

pimeys commented 3 years ago

Now the variables actually work! Still a few things feel different compared to the nixpkgs version: Copy&paste from firefox to the full gtk version of emacs just doesn't work at all (not the xwayland version), and fonts e.g. in waybar look quite bitmappy in the master version.

pimeys commented 3 years ago

So, I was able to solve the copy&paste problem. It happens if you start emacs daemon as a systemd service. The idea is to set certain environment variables and restart the emacs service after starting sway. Here are the needed configuration variables:

https://github.com/pimeys/nixos/blob/main/home.nix#L75-L76

Running the overlay now successfully and got my config even to a cleaner state:

https://github.com/pimeys/nixos/commit/9f9326027e38e5505ba79e31feefdc2bafdc6965

Thank you for all the help.