Installing an older version of a package alongside the newer one for debugging purposes

I’m trying to find out which version of sway introduced a change in behavior for me (related to Contradiction in man page and regression in multi-output workspace creation · Issue #8522 · swaywm/sway · GitHub). I’d like to build sway 1.8.1 independently of my system and run it with a command like sway181.
I tried copying the sway 1.8.1 package definition, but it required wlroots 0.16. So I copied it too, but I’m just digging myself into a hole because then there are even more dependencies that do not exist anymore that I would have to copy.

I’m sure there is an easy way for me to simply build sway from a specific commit of nixpkgs, but I’m missing it.
I’m using flakes, here’s my repo: GitHub - sweenu/nixfiles: NixOS home and servers configuration

Right.

There’s no necessarily “easy” way around this, because if you just create a second nixpkgs instance (add a new channel and then ((import <nixpkgs-whatever> {}).sway)) and get sway that way, you risk other issues. Since that’s low-effort, you can give that a try, but I would expect a lot of issues due to graphical driver impurity on NixOS.

This should explain how to install sway 1.8.1

Again, that will probably cause some issues as I alluded to earlier.

And do not use nix-env for the love of everything.

Thank you guys for your help. Sway 1.8.1 does launch, but has errors making it crash right away. I’m sure this would have worked better for a simpler program.

Here are the errors if you want to know:

00:00:00.062 [ERROR] [wlr] [render/egl.c:204] EGL_EXT_platform_base not supported
00:00:00.062 [ERROR] [wlr] [render/egl.c:506] Failed to create EGL context
00:00:00.062 [ERROR] [wlr] [render/gles2/renderer.c:679] Could not initialize EGL
00:00:00.062 [DEBUG] [wlr] [render/wlr_renderer.c:271] Failed to create a GLES2 renderer. Skipping!
00:00:00.062 [ERROR] [wlr] [render/wlr_renderer.c:333] Could not initialize renderer
00:00:00.062 [ERROR] [sway/server.c:79] Failed to create renderer

I think it’s related to hardware.opengl which is superseded by hardware.graphics which is enabled in my config :man_shrugging: .