-
-
Notifications
You must be signed in to change notification settings - Fork 32
nix: Add Nix Flake support #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I finally had delivery of a VITURE Pro today, after being lost, but I've tested my Flake with the glasses, and it does seem to work - about to test mouse control shortly. |
The long-term steps would be to upstream the derivation (+ Breezy) to Nixpkgs, as well as a Nix module, and a CI workflow for this repo (+ Breezy). |
489b7fc
to
fba3fa3
Compare
519285a
to
77822f9
Compare
aa811c1
to
8140a66
Compare
@shymega can you let me know if this is ready? Also can you have another Nix user test and sign off on it? |
As for another Nix user I'm here. I actually already put together a Nix package for the driver but this one looks further along than mine so will test. Will post my findings here in the next few days. |
Okay so it builds and I can install the driver but I seem to be having some issues connecting to my Viture Pro glasses. I get the following in the xrDriver log. 2025-04-28 22:02:40.853 Project version: 1.1.0 In kernel logs I have this when I plug in the glasses. [ 187.344812] usb 2-1: new full-speed USB device number 7 using xhci_hcd So the glasses are being recognised by the kernel. For refernce this is NixOS unstable running kernel 6.12.24. |
You might want to try rebasing this branch, as main is on 2.x and may include a fixing change for that. But first you could try to see if this persists after a restart. And try not having the glasses plugged in on boot. |
Yes, this isn't a problem with my package. I did raise it with @wheaney over Discord, but the solution isn't clear yet. Have you put the udev rules in your |
I'll rebase this now. |
Tried a restart and adding the udev rules but still getting the same output for now. |
8140a66
to
4dabde1
Compare
@deephack1982 Try now :-) I'm also working on a Guix package, if that's of interest to anyone following this thread. |
New one gives me a build failure with the following make output. [ 58%] Building C object CMakeFiles/xrDriver.dir/src/ipc.c.o Tested and this is present on wheaneys main branch if I do a basic cmake and make so nothing up with the flake. 2.0.5 tag builds cleanly however. |
Yeah, the Flake builds from the Git repo, but I didn't have any issues building. |
How did you invoke the Flake? |
I allow the direnv to load and then issue the nix-build command in the root. |
Ah, I can reproduce it now. It was cached. Try building from |
That branch builds fine but the driver output is still the same. Connection attempt fails and then it retries in a loop. |
Quick note by the way as I was looking into the udev rules and how to package them. As per this thread it seems that any package containing $out/lib/udev/rules.d/ will be picked up by the system automatically. Actually not quite automatically, you need to specify sevices.udev.package = [ mypackage ]; but anyway. https://discourse.nixos.org/t/how-to-create-files-in-the-etc-udev-rules-d-directory/11929/13 |
I found this happened for me too, but not on the first connection cycle of my VITURE Pros. |
Ah, that's good to hear. So the way I've packaged it makes this seamless. |
Somewhat related, I'm working on a Breezy-Desktop package also. I have the following attached which builds but shows an error on run. |
For that you'll just need to disable the verification that the UI app does. See how the AUR setup does it by injecting |
That worked immediately. Fantastic, now I'll spend some time tidying all of this up. Eventually it would be good to have the overlay load the needed files directly from Github. Then it could be just a couple of lines of config in configuration.nix to get everything working. For now though it can be manually installed and run. |
The derivation explains it - the systemd service is a user service, and you're executing the system Try |
Thanks! |
I'll edit the udev path, but if you can test the systemd unit as well, that would be great. I use Home Manager for installing the CLI, which works for me. My overlay setup is slightly more complex, and I don't think you use Flakes, right? |
Interesting approach, but I think a better approach would be to build from source. One of Nix's central tenets is reproducibility after all. I have a prototype Breezy Desktop package, but I'm awaiting for the KDE stuff to be formally released before I release mine. I think it would be beneficial to use Flakes, too. |
4dabde1
to
bc93524
Compare
My personal opinion is that changing from I think one improvement would be to use the correct filenaming for udev rules as mentioned in the Nixpkgs issue upstream. However, further debugging will be required to fix the device detection under userspace. |
Sure thing, I can re-test with your updated version. The udev thing I don't fully understand, I just know that it worked for me. I'm basing my pathing on the documentation of this option here https://search.nixos.org/options?channel=24.11&show=boot.initrd.services.udev.packages&from=0&size=50&sort=relevance&type=packages&query=services.udev There may be other mechanisms for copying udev rules from an installed package however so I don't doubt your comment about the pathing. Thanks for the tip on systemd, when I check the user scope though it's still not there on my package. I test again with yours. |
One issue that I just noticed I am having is that I cannot seem to create virtual displays. I click the plus button and they appear in the list below but after a short delay they are removed from the list and never appear in the glasses. @wheaney any ideas? |
The virtual displays are kicked off by their own executable in the same directory as the UI executable. It logs to the same UI log, so I would check there first. |
Thanks for the pointer. When I ran that directly it complained about a missing pipewire dependency. With that added and the package rebuilt I now have multiple virtual monitors working very nicely. Thanks! |
bc93524
to
c6cd02d
Compare
@shymega Is this PR rebased off of 2.0.5 now or should I use the other branch before I test? |
@deephack1982 This PR is still based off |
Can you make a PR to Breezy for this derivation, and then I can build on that to build from source, along with Flake support? Thanks :) |
Okay, just tried this one based on master. It does build for me but the systemctl unit doesn't appear and the udev rules don't get applied either. For reference I'm doing the following to build and install it.
|
I've just realised that my package isn't actually working correctly as while it works on my main machine it doesn't work from a fresh install on another computer. Turns out all the XDG_DATA_HOME stuff was already manually installed in my case from a previous run of the setup script. I need to add handling the following ~/.local/share/applications/com.xronlinux.BreezyDesktop.desktop Then glib-compile-schemas needs to be run and the extension installed. If you manually do all these things then my package works as it currently stands so still quite a bit to do. Current version of it is attached for now though. In the meantime I'll work on cleaning it up a bit and making the xrlinuxdriver overlay source from a flake as that will make it cleaner for me. |
This is my initial draft, which handles glib schema compilation as well- wheaney/breezy-desktop#113. I think ultimately what we want to aim for is from-source builds. |
I don't use I haven't tried the one based on master, as I'm only using v2.0.5, but let me try There is currently no way to lock a release from a tag in the derivation, as I build it directly from the root of the Flake. |
I'm fairly new to Nix so I'm mostly using the original nix commands. If you can list the commands you use to install then I'll test with the same ones you do. |
I only use overlays as part of my overly complex NixOS config. You could try |
@deephack1982 Did you try this? |
So I am testing this out and am using the config listed by @shymega. You can confirm looking here... https://github.com/seanybaggins/nix-home/commit/9e0ba8988d764cf1ea5f407d15d781d1f4fda4e1 I am not sure I am observing successful behavior. When wearing the glasses, the screen is always appearing directly in front of me.
Looks like I dont have a manafest file at |
@seanybaggins This is expected behaviour. XRLinuxDriver doesn't implement multiple screens - Breezy does, but this is a separate issue. What you're seeing is a functioning Flake for XRLinuxDriver, and therefore it can now be merged, I am happy to say. You can test the state by running Breezy is more complex, as we'll need to build from source rather than using binaries, and this requires a few hacks. I am working on this separately. If @wheaney is happy to merge this MR, I can then upstream my Nixpkgs branch to Nixpkgs, and it'll be backported to 25.05. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the README with instructions for Nix setup, also rebase and update any version numbers.
nix/default.nix
Outdated
in | ||
stdenv.mkDerivation rec { | ||
pname = "xrlinuxdriver"; | ||
version = "0.12.0.1"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll want to rebase and make sure the version matches the latest driver version (it's on 2.0.x now).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we should probably drop "linux" from the naming since it's redundant based on the context (Nix being linux-specific). e.g. for AUR I called this just xr-driver-git
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wheaney Nix isn't always Linux specific. There is also support for Darwin (macOS). Also, generally, Nix derivation pname
s follow the name of the source repository.
I can rebase and update the driver version, but I think the version should follow the Nix convention of 'unstable' or 'git', given we're building from the repo via Git.
The version tags inside the source code will follow how you've coded that aspect.
If we do upstream to Nixpkgs in future, we can set the version to the repo, but I think for the Flake inside the direct source repository, the version in the Nix code should not be locked to a certain version.
- Add Nix Flake support, with devShells and an Nix overlay. - Add support for legacy Nix with `default.nix` and `shell.nix` for the package and devShell, respectively. - Add `.envrc` to automatically enter a Nix devShell. - Add a package in `nix/default.nix` for the main package entrypoint. Closes: wheaney#38
c6cd02d
to
17a67cd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also update the README with Nix instructions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be downgrading the submodule, d101fa
is the latest commit
This commit consists of the following changes:
default.nix
/shell.nix
This allows for legacy Nix tooling like
nix-build
/nix-shell
to work.flake.nix
This is for the (new) Nix Flake support.
flake.lock
As above, but for tracking Flake inputs.
.envrc
This allows for a fully self-contained developer environment to be
setup with Nix.
nix/default.nix
This is the main package derivation. Both this repo & Nixpkgs are
derived from the same codebase.
Closes: #38