dawsers / hyprscroller

Hyprland layout plugin providing a scrolling layout like PaperWM
MIT License
200 stars 12 forks source link

Doesn't build on NixOS #48

Closed quantum9Innovation closed 2 months ago

quantum9Innovation commented 2 months ago

I am using hyprscroller.url = "github:dawsers/hyprscroller"; as a flake input to my NixOS system configuration, and I've added hyprscroller as a Hyprland plugin with:

wayland.windowManager.hyprland.plugins = [ inputs.hyprscroller.packages.${pkgs.stdenv.hostPlatform.system}.hyprscroller ]

I am using an x86_64-based system. When I build my system using this configuration, I get the following error indicating some kind of internal issue in the hyprscroller build process (see below).

building the system configuration...
error: builder for '/nix/store/jjs4k2i2rwwl12z4mgjphvzzdhj1awi9-hyprscroller-date=2024-09-02_462376d.drv' failed with exit code 2;
       last 10 log lines:
       > /build/source/src/scroller.h:11:7: note:   because the following virtual functions are pure within 'ScrollerLayout':
       >    11 | class ScrollerLayout : public IHyprLayout {
       >       |       ^~~~~~~~~~~~~~
       > In file included from /build/source/src/scroller.h:1:
       > /nix/store/30rri4jr45y2bamsyivpp25prx0jx9dn-hyprland-0.41.2+date=2024-07-03_e894d5e-dev/include/hyprland/src/layout/IHyprLayout.hpp:113:18: note:     'virtual void IHyprLayout::fullscreenRequestForWindow(PHLWINDOW, eFullscreenMode, bool)'
       >   113 |     virtual void fullscreenRequestForWindow(PHLWINDOW, eFullscreenMode, bool) = 0;
       >       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
       > make[2]: *** [CMakeFiles/hyprscroller.dir/build.make:76: CMakeFiles/hyprscroller.dir/src/main.cpp.o] Error 1
       > make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/hyprscroller.dir/all] Error 2
       > make: *** [Makefile:91: all] Error 2
       For full logs, run 'nix log /nix/store/jjs4k2i2rwwl12z4mgjphvzzdhj1awi9-hyprscroller-date=2024-09-02_462376d.drv'.
error: 1 dependencies of derivation '/nix/store/2yr97ymsxcgmp3i7gxji2rvjpnp1bjyb-hm_hyprhyprland.conf.drv' failed to build
error: 1 dependencies of derivation '/nix/store/q3cv1a72lb4zgv04nsk379b0lqh4b4lk-activation-script.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ah39hcn702d6hwk55sbzm7sj8jrxp7gj-home-manager-generation.drv' failed to build
youwen5 commented 2 months ago

Reproduced by nix build github:dawsers/hyprscroller.

error: builder for '/nix/store/jjs4k2i2rwwl12z4mgjphvzzdhj1awi9-hyprscroller-date=2024-09-02_462376d.drv' failed with exit code 2;
       last 25 log lines:
       >       |                          ^~~~~~~~~~~
       > /build/source/src/scroller.h:57:29: error: 'WORKSPACEID' has not been declared
       >    57 |     Row *getRowForWorkspace(WORKSPACEID workspace);
       >       |                             ^~~~~~~~~~~
       > In file included from /nix/store/zc0nsv23pakbafngjy32kvhfzb16as43-gcc-13.3.0/include/c++/13.3.0/bits/shared_ptr_base.h:59,
       >                  from /nix/store/zc0nsv23pakbafngjy32kvhfzb16as43-gcc-13.3.0/include/c++/13.3.0/bits/shared_ptr.h:53,
       >                  from /nix/store/zc0nsv23pakbafngjy32kvhfzb16as43-gcc-13.3.0/include/c++/13.3.0/chrono:49,
       >                  from /nix/store/30rri4jr45y2bamsyivpp25prx0jx9dn-hyprland-0.41.2+date=2024-07-03_e894d5e-dev/include/hyprlan
d/sr
c/debug/Log.hpp:6,
       >                  from /nix/store/30rri4jr45y2bamsyivpp25prx0jx9dn-hyprland-0.41.2+date=2024-07-03_e894d5e-dev/include/hyprlan
d/sr
c/config/ConfigManager.hpp:6,
       >                  from /build/source/src/main.cpp:1:
       > /nix/store/zc0nsv23pakbafngjy32kvhfzb16as43-gcc-13.3.0/include/c++/13.3.0/bits/unique_ptr.h: In instantiation of 'constexpr s
td::
__detail::__unique_ptr_t<_Tp> std::make_unique(_Args&& ...) [with _Tp = ScrollerLayout; _Args = {}; __detail::__unique_ptr_t<_Tp> = __
deta
il::__unique_ptr_t<ScrollerLayout>]':
       > /build/source/src/main.cpp:50:1:   required from here
       > /nix/store/zc0nsv23pakbafngjy32kvhfzb16as43-gcc-13.3.0/include/c++/13.3.0/bits/unique_ptr.h:1070:30: error: invalid new-expre
ssio
n of abstract class type 'ScrollerLayout'
       >  1070 |     { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
       >       |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       > /build/source/src/scroller.h:11:7: note:   because the following virtual functions are pure within 'ScrollerLayout':
       >    11 | class ScrollerLayout : public IHyprLayout {
       >       |       ^~~~~~~~~~~~~~
       > In file included from /build/source/src/scroller.h:1:
       > /nix/store/30rri4jr45y2bamsyivpp25prx0jx9dn-hyprland-0.41.2+date=2024-07-03_e894d5e-dev/include/hyprland/src/layout/IHyprLayo
ut.h
pp:113:18: note:     'virtual void IHyprLayout::fullscreenRequestForWindow(PHLWINDOW, eFullscreenMode, bool)'
       >   113 |     virtual void fullscreenRequestForWindow(PHLWINDOW, eFullscreenMode, bool) = 0;
       >       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
       > make[2]: *** [CMakeFiles/hyprscroller.dir/build.make:76: CMakeFiles/hyprscroller.dir/src/main.cpp.o] Error 1
       > make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/hyprscroller.dir/all] Error 2
       > make: *** [Makefile:91: all] Error 2
       For full logs, run 'nix log /nix/store/jjs4k2i2rwwl12z4mgjphvzzdhj1awi9-hyprscroller-date=2024-09-02_462376d.drv'.

Full trace: hyprscroller.log

dawsers commented 2 months ago

@quantum9Innovation you are using Hyprland v0.41.2 and trying to build the latest hyprscroller against it. I don't use NixOS so I don't know how it works, but if you want to use Hyprland v0.41.2, you should use hyprpm to build hyprscroller. It will try to build the correct version of the plugin for the version of Hyprland you are using.

@youwen5 I think you are doing the same thing.

hyprpm add https://github.com/dawsers/hyprscroller
# verify it installed correctly
hyprpm list
hyprpm enable hyprscroller

and add the following to your hyprland.conf

# Load hyprpm managed plugins
exec-once = hyprpm reload -n
quantum9Innovation commented 2 months ago

Ideally on NixOS you would not want to use hyprpm since it's not officially supported or recommended by Hyprland (on NixOS) and goes against Nix's declarative configuration philosophy. What specific version of hyprscroller should I be using? I can change that from my nix config without having to use hyprpm.

dawsers commented 2 months ago

I see. hyprpm uses hyprpm.toml to decide which version of the plugin to use depending on the version of hyprland on the system. The array of pairs in commit_pins defines a correspondence between a Hyprland version and a hyprscroller version.

So in your case, Hyprland v0.41.2 is commit 918d8340afd652b011b937d29d5eea0be08467f5. Looking at hyprpm.toml, the corresponding hyprscroller version is 4121019cde46c80fce78cf985a4bb8a04f74712e

youwen5 commented 2 months ago

It looks like your flake.lock isn't being bumped alongside source code updates? I'm assuming you're not the one maintaining it and/or not using Nix.

Generally consumers of flakes expect them to build their packages without further action since they should be reproducible and specify all dependencies, which although the flake in this repo does, its lockfile hasn't been updated to use hyprland 0.42.0, causing build failure (I'm on Hyprland 0.42.0, the current version in nixpkgs unstable, so there doesn't seem to be a mismatch between the latest hyprscroller and my hyprland version. It's likely just because the flake lockfile is still specifying hyprland 0.41.2 for building).

In any case, nix flake update lets it build properly. I can open a PR to fix it, if you want? Looks like someone is already working on updating it with a long term solution in a draft PR but a simple flake update should fix the failing build for the time being.

quantum9Innovation commented 2 months ago

I can confirm after building with dawsers/hyprscroller/f43a0d4ee839e3a6a3a2fe992b5ee8f78fbe0b11 and hyprwm/Hyprland/9a09eac79b85c846e3a865a9078a3f8ff65a9259 (v0.42.0) that the error persists, so it's not an issue of the versions not matching.

dawsers commented 2 months ago

I don't really know much about NixOS configuration. The problem I see is every user can have a different version of hyprland installed, as I understand that is the beauty of NixOS (update what you want when you want to). So for example, in your case you decided to stay on v0.41.2. Some people follow the latest tagged version (v0.42.0), and others prefer to follow Hyprland's latest git. I don't know if all these combinations are possible with a single "flake". That is why I suggested using hyprpm, because it was designed for that: build the version of the plugin that corresponds to the version of Hyprland on the system.

There is an ongoing PR by the person who has been helping with NixOS maintenance https://github.com/dawsers/hyprscroller/pull/47 It would be great if you guys decide something that fixes this ongoing problem. It is by far the biggest source of issues in this repo.

dawsers commented 2 months ago

@quantum9Innovation Could I see the log for that build? It is the combination I am currently using and I can build it. Most people on Arch are using Hyprland v0.42.0, and that is the version that gets built for it.

I fear you updated to Hyprland v0.42.0 but are probably using the latest hyprscroller.

quantum9Innovation commented 2 months ago

I tried it again with Hyprland v0.42.0 and @youwen5's fork https://github.com/youwen5/hyprscroller and my system builds (I think the flake for this repository might not have been updated). However, I am now getting the following error from Hyprland: failed to load the following plugins: /nix/store/.../lib/libhyprscroller.so. This is probably a Hyprland/Nix issue, so I'll have to look into it a bit to see what my options are.

youwen5 commented 2 months ago

Ok, I believe I've gotten to the bottom of this after some fiddling.

Basically what I said earlier about the flake lockfile

It looks like your flake.lock isn't being bumped alongside source code updates? I'm assuming you're not the one maintaining it and/or not using Nix.

is correct, which fixes the build issue. The other issue @quantum9Innovation was having was a version mismatch because they were likely using an older version of Hyprland (which was after 0.42.0, but not yet caught up to latest git master), and the latest commit of hyprscroller only works on the latest Hyprland master, not 0.42.0 stable, which was not entirely clear at first since the only version pinning/release versioning is in hyprpm.toml.

Anyways I just noticed the hyprscroller in nixpkgs was just updated so nixos-unstable users can use that and I've opened a PR to fix the failing build here so people following the official hyprland flake can use this repo as well. #49 should close this.

dawsers commented 2 months ago

Thank you for your help. I will have a look at the PR and merge it.

The way I support hyprscroller is I create a hyprpm.toml commit pin entry that links each Hyprland tagged version to the current latest compatible hyprscroller commit. At the moment, the latest tag is for v0.42.0, but using hyprpm one can install hyprscroller for several older Hyprland versions. Aside from that, the HEAD version of hyprscroller may be updated (or not) to support hyprland-git, but I make no assurances about that, as I cannot follow every single change that goes on upstream. Sometimes I update some code (for example today), but I usually wait for a tagged version. Most times, hyprscroller's HEAD is not compatible with hyprland-git.

youwen5 commented 2 months ago

No problem, thanks for making a useful plugin.

One thing that would help people not using hyprpm is some sort of official semantic versioning or basic release pinning. Then, anyone consuming this flake can add a ?ref=[release tag] so they don't unknowingly follow a bleeding edge version that may or may not be compatible with their hyprland.

Of course, that is a little more work to support so it's totally up to you whether you want to release official versions or not. In any case, hyprlandPlugins.hyprscroller has been packaged in the official nixpkgs repos so NixOS users can use that instead of this repo's flake directly, which should be version pinned and pass CI checks to ensure it builds against the hyprland in nixpkgs at the time. Maybe just add a brief note about that in the README?

dawsers commented 2 months ago

I will update the README to point people to the official unstable Nix package, thank you.