-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
Perfecting NixGL Wrappers for Home-Manager Use #163
Comments
Hey @RicSanOP, my wrapper handles this by returning the original package modified via overrideAttrs. This way, only the necessary attributes are overridden, and any other attributes required by home manager are preserved. The problem with your wrapper is that |
Hey @Smona , I had taken a look at your wrapper previously. What had initially caused me to hesitate from using it was that the wrapped package is named differently from the original (with the nixGL- prefix). But I guess that was just a matter of not overriding the old name. I will also admit that the setup was a bit more daunting. Does your wrapper also handle .desktop files well? I am sure you see my lack of experience on this matter, so any points of comparison between your and @ntsanov wrapper on the same thread would be appreciated. The merge operator |
thanks for that feedback! the .desktop files appear to work perfectly with my wrapper, because all files from the original package are symlinked into the wrapper package so they exist where they need to once installed. The setup may be a little more complicated, but you can skip defining the nixgl prefix setting if you only need to use one GPU variant. I designed it that way so that the config module which includes nixgl-wrapped packages can be shared between multiple system definitions, with the nixGL variant passed in via the per-system top-level config. This also prevents unnecessary nixGL variants from being installed on each system like your example code does. you can see a full example of integrating the wrapper this way in my config repo. As far as buildEnv vs overriding the package, IIRC the main downside with buildEnv was that supporting files (like .desktop or files in /share) were not linked into the user profile if the returned value from the wrapper wasn't a derivation, so app installations would be a bit broken. |
For cross reference, there is also nix-community/home-manager#3968 May we continue there, and close this issue? |
@RicSanOP nix-community/home-manager#3968 has been merged, consider closing if that meets your needs. |
Hello Everyone,
I am new to using nix and home-manager and have been enjoying tinkering around with functional package management. I have reached the point where I can more or less read nix code (like the wrappers in #114). I have gone through the process of setting up home-manager on a non-nixOS distro (Pop_OS! in my case) and have rewritten @ntsanov wrapper code from #114 into the following functions
Here are some successful usages of these wrapper functions in my
home.nix
file:Now as you may have noticed, the nixgl wrap around
pkgs.alacritty
andpkgs.wezterm
have been commented out fromhome.packages
as they are required in their respectiveprograms.__TERMINAL__.package
attributes. Providing the nixgl wrapped derivation has worked fine forwezterm
, but unfortunately hasn't worked foralacritty
due to the following error:It is clear that the wrapper function I use somehow loses the
version
attribute which is set in nixpkgs at https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/terminal-emulators/alacritty/default.nix and referenced in home-manager at https://github.com/nix-community/home-manager/blob/master/modules/programs/alacritty.nix as can be seen in the error lineuseToml = lib.versionAtLeast cfg.package.version "0.13";
. I came to understand this after playing around with thebuiltins.trace
function and seeing that the wrapped output did not have aversion
parameter.Even though I understand the issue, I am very much at a loss on how to re-add the
version
attribute to the nixgl wrapped derivation. Even if a hacky, I would deeply appreciate any help on navigating this issue and getting the nixgl wrapped version ofalacritty
to work with home-manager. Thank you to any and all in advance.The text was updated successfully, but these errors were encountered: