File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -152,8 +152,47 @@ For Vulkan programs:
152152``` bash
153153$ nixVulkanNvidia program args
154154$ nixVulkanIntel program args
155+
156+ # # Wrapping applications
157+ If you are using home-manager, you can use this approach to avoid having to add the wrapper call
158+ each time:
159+
160+ ` ` ` nix
161+ let
162+ nixGLWrap = drv: binary: pkgs.symlinkJoin {
163+ name = " ${drv.name} -nixglwrapped" ;
164+ paths = [ drv ];
165+ buildInputs = [ pkgs.makeWrapper ];
166+ postBuild = ' '
167+ # This will break if wrapProgram is ever changed, so fingers crossed
168+ makeShellWrapper () {
169+ local original=" $1 "
170+ local wrapper=" $2 "
171+ cat << EOF > "$wrapper "
172+ #! ${pkgs.bash} /bin/bash -e
173+ exec "${pkgs.nixgl.auto.nixGLDefault} /bin/nixGL" "$original "
174+ EOF
175+ chmod +x "$wrapper "
176+ }
177+
178+ wrapProgram "$out /bin/${binary} "
179+ '';
180+ };
181+ in {
182+ home.packages = [
183+ (nixGLWrap "glxinfo" glxinfo)
184+ ];
185+ }
155186` ` `
156187
188+ This generates a wrapper script that automatically adds the ` nixGL` call so you won' t have to
189+ remember it.
190+
191+ This could be done simpler with
192+ `writeShellScriptBin "glxinfo" "${..}/bin/nixGL ${glxinfo}/bin/glxinfo"`
193+ but this way, only the binary will be available in your environment and you' ll [lose manpages and
194+ possibly important supporting files](https://nixos.wiki/wiki/Nix_Cookbook#Wrapping_packages).
195+
157196# OpenGL - Hybrid Intel + Nvidia laptop
158197
159198After installing ` nixGLIntel` and ` nixGLNvidiaBumblebee` .
You can’t perform that action at this time.
0 commit comments