Overlay for Sway and other Wayland WMs & tools


I’ve been using sway recently, as it approaches v1.0, and I’ve recently put together a Nixpkgs overlay that provides a number of packages at their very latest tip of HEAD revisions.

At this time, I’ve packaged:

  • sway-beta
  • wlroots
  • grim (screenshot tool for sway/wlroots-based compositors)
  • slurp (selection tool to be used with grim)
  • wlstream (video capture tool for sway/wlroots-based compositors)
  • wayfire (wf-config)
  • waybar
  • redshift-wayland

I’m potentially interested in packaging more. I’m aware of some other wlroots-related compositors and hope to add more over time as I decide to kick the tires on them.

(Note that a couple of the packages in the overlay are taken from commits that are in nixpkgs, but not yet in nixos-unstable. As of now, the overlay works with the current revision of nixos-unstable. Specifically, there was work done by others on sway-beta and wlroots to make them buildable today, given the state of meson, that I’m just publishing in the overlay for convenience. I’m very thankful for their contributions; all credit goes to them.)

If you take a look at the update script(s), you’ll see that it’s made to be:

  • easy to update
  • easy to test against the most recent nixos-unstable

And for fun, I do also push pre-built packages to a binary cache; more information is in the README.

This is my first time creating an overlay, and my first time putting together more than one-off Nix changes. I would highly appreciate any feedback. (Issues and PRs are great too, of course!)

(I’m also open to suggestions if there’s a better name, or better naming scheme for the overlay.



This is really cool. I have attempted to package sway 1.0beta2 last week but it was too much work, and now you did it! It’s also nicely documented and structured.

If you intend to keep the overlay after sway 1.0 has been released then you might want to look into is NUR. You could attach your overlay to NUR and make it available for all NUR users if you wanted.

In terms of naming the convention seems to be nixpkgs-<something>. For example nixpkgs-mozilla.

I’ve gone ahead and renamed the repo to nixpkgs-wayland. I’ve also started pushing to a Cachix cache (nixpkgs-wayland.cachix.org), in addition to my own private cache, it’s listed in the README.

I might add it to the NUR, but I’m not totally sure of the benefit yet, and I’m not sure if they support proper overlays, I didn’t see any in the exact overlay style I’m using, but it might not be an issue.

1 Like


The cachix cache is only useful if the user has a similar enough version of nixpkgs where none of the dependencies have changed. It’s hard to know how often that would be the case. Probably building with 18.09 might yield a higher overlap.

I had hoped more people were on nixos-unstable, but maybe not?

I’ve attempted to add the release channel as well, but the very first dependency of the most base package is already going to need to be “backported” into the overlay. I’m not super interested in maintaining another extra set of packages beyond what is already in nixpkgs, albeit in nixos-unstable branch.

On the other hand, I can add just usage instructions that show how to utilize the overlay with nixos-unstable regardless of what your system is using. This is what I was doing before I made the overlay anyway, effectively. Also, I suspect anyone trying to adopt Wayland, with Nix, right now, are probably okay with any potential extra disk space used from dupes, etc.

I guess a downside to this is, if users have to import the packages, rather than using an overlay, things like nixos modules might not be as intuitive since they will reference the wrong package.

At least for sway-beta this shouldn’t be a problem since the module accepts the package as an argument.

Thanks to both of you for this. I wanted to try sway for a while and I have been running it since nearly when the overlay was out and I enjoy it a lot.

Same, I can’t believe wayland is actually usable now, after more than 10 years in the making. Thanks again @colemickens for starting this project!

1 Like