Skip to content

Conversation

@juuyokka
Copy link

@juuyokka juuyokka commented Nov 6, 2025

This PR adds a basic Nix flake using flake-parts to provide two packages for Nix users:

  • The qml-niri plugin itself
  • Quickshell with qml-niri support built in

It's mostly a "set it and forget it" kind of deal as it is quite simple. I have also added instructions on how to use the packages in the README, but note that the url points to my fork, so please change it upon merging.

Great work bridging the gap for niri users!

@juuyokka juuyokka force-pushed the feat-nix-flake branch 2 times, most recently from fef7751 to 448f27c Compare November 14, 2025 21:07
Copy link
Owner

@imiric imiric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks a lot for this! 🙇 And sorry for the response delay. For some reason, I'm not getting notifications for this repo... 😕

I don't use Nix for development, though I do use NixOS on a couple of machines, and have some (love/hate) experience with it. I actually tried setting something like this up for building the plugin and using it on my dev Void Linux machine, since I would really like to have an isolated build environment and simplify the building instructions, but I ran into issues with shared library mismatches, and couldn't get it to work. Do you think it would be possible to setup such a cross-platform build system using Nix, that essentially produces the .so files of the plugin? Or is this only useful if the user is already using Nix(OS)?

For example, I tried running nix build with these changes, and got this error:

Expand
error: Cannot build '/nix/store/04g9zhr7rlgcs7d91597zqknb8y9spy6-qml-niri-0.1.drv'.
       Reason: builder failed with exit code 1.
       Output paths:
         /nix/store/h1igiypr88nrv64684k09aha4svsy1ww-qml-niri-0.1
       Last 25 log lines:
       > [ 48%] Building CXX object CMakeFiles/Niri.dir/niri_qmltyperegistrations.cpp.o
       > [ 56%] Building CXX object CMakeFiles/Niri.dir/src/logging.cpp.o
       > [ 56%] Building CXX object CMakeFiles/Niri.dir/src/icon.cpp.o
       > [ 60%] Building CXX object CMakeFiles/Niri.dir/src/niri.cpp.o
       > [ 64%] Building CXX object CMakeFiles/Niri.dir/src/ipcclient.cpp.o
       > [ 68%] Building CXX object CMakeFiles/Niri.dir/src/windowmodel.cpp.o
       > [ 72%] Building CXX object CMakeFiles/Niri.dir/src/workspacemodel.cpp.o
       > [ 76%] Linking CXX shared library Niri/libNiri.so
       > [ 80%] Built target Niri
       > [ 80%] Built target Niriplugin_autogen_timestamp_deps
       > [ 84%] Automatic MOC and UIC for target Niriplugin
       > [ 84%] Built target Niriplugin_autogen
       > [ 92%] Building CXX object CMakeFiles/Niriplugin.dir/Niriplugin_autogen/mocs_compilation.cpp.o
       > [ 92%] Building CXX object CMakeFiles/Niriplugin.dir/Niriplugin_NiriPlugin.cpp.o
       > [ 96%] Linking CXX shared module Niri/libNiriplugin.so
       > [100%] Built target Niriplugin
       > Running phase: glibPreInstallPhase
       > Running phase: installPhase
       > Running phase: fixupPhase
       > shrinking RPATHs of ELF executables and libraries in /nix/store/h1igiypr88nrv64684k09aha4svsy1ww-qml-niri-0.1
       > shrinking /nix/store/h1igiypr88nrv64684k09aha4svsy1ww-qml-niri-0.1/lib/qt-6/qml/Niri/libNiri.so
       > shrinking /nix/store/h1igiypr88nrv64684k09aha4svsy1ww-qml-niri-0.1/lib/qt-6/qml/Niri/libNiriplugin.so
       > checking for references to /var/nix/builds/nix-build-qml-niri-0.1.drv-5163-543824116/ in /nix/store/h1igiypr88nrv64684k09aha4svsy1ww-qml-niri-0.1...
       > RPATH of binary /nix/store/h1igiypr88nrv64684k09aha4svsy1ww-qml-niri-0.1/lib/qt-6/qml/Niri/libNiriplugin.so contains a forbidden reference to /var/nix/builds/nix-build-qml-niri-0.1.drv-5163-543824116/
       > Some binaries contain forbidden references to /var/nix/builds/nix-build-qml-niri-0.1.drv-5163-543824116/. Check the error above!
       For full logs, run:
         nix-store -l /nix/store/04g9zhr7rlgcs7d91597zqknb8y9spy6-qml-niri-0.1.drv

As usual with Nix, I have no idea how to troubleshoot this, if the issue is on my side or not... 😮‍💨 The build was successful, but some "references" are "forbidden"...? The full logs are not helpful either.

Anyway, I'd be happy to merge this, though since I likely won't be using it and find Nix confusing, I'm not sure I'd be able to troubleshoot any issues. So I might ping you in that case, if that's OK with you.

@kittywitch
Copy link

kittywitch commented Dec 5, 2025

Hi, I tried this PR and I did not get an error pertaining to forbidden references.

at 06:29:22 ❯ nix --version
nix (Lix, like Nix) 2.93.3
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/kat/.config/nix/nix.conf:/nix/store/yj4ix8dplb64m7vnxlrymm91nqff91n9-stylix-kde-config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/kat/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/kat/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/kat/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/w7x0993gjpy31k5v5xklnqmd8q0br8h0-lix-2.93.3/share

[kat@goliath:~/src/third-party/qml-niri]$ nix build

[kat@goliath:~/src/third-party/qml-niri]$ ls
assets  CMakeLists.txt  default.nix  flake.lock  flake.nix  justfile  LICENSE  README.md  result  src  test

[kat@goliath:~/src/third-party/qml-niri]$ ls result/lib/qt-6/
qml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants