nixgl: Improve option documentation

This commit is contained in:
Mel Bourgeois 2024-08-09 19:40:33 -05:00
parent f54a6b0076
commit 830c928697
No known key found for this signature in database
GPG key ID: 290FCF081AEDB3EC

View file

@ -10,12 +10,28 @@ in {
example = lib.literalExpression
''"''${inputs.nixGL.packages.x86_64-linux.nixGLIntel}/bin/nixGLIntel"'';
description = ''
The nixGL command that `lib.nixGL.wrap` should wrap packages with.
This can be used to provide libGL access to applications on non-NixOS systems.
The [nixGL](https://github.com/nix-community/nixGL) command that `lib.nixGL.wrap` should prefix
package binaries with. nixGL provides your system's version of libGL to applications, enabling
them to access the GPU on non-NixOS systems.
Wrap individual packages like so: `(config.lib.nixGL.wrap <package>)`. The returned package
can be used just like the original one, but will have access to libGL. If this option is empty (the default),
then `lib.nixGL.wrap` is a no-op. This is useful on NixOS, where the wrappers are unnecessary.
Wrap individual packages which require GPU access with the function like so: `(config.lib.nixGL.wrap <package>)`.
The returned package can be used just like the original one, but will have access to libGL. For example:
```nix
# If you're using a Home Manager module to configure the package,
# pass it into the module's package argument:
programs.kitty = {
enable = true;
package = (config.lib.nixGL.wrap pkgs.kitty);
};
# Otherwise, pass it to any option where a package is expected:
home.packages = [ (config.lib.nixGL.wrap pkgs.hello) ];
```
If this option is empty (the default), then `lib.nixGL.wrap` is a no-op. This is useful for sharing your Home Manager
configurations between NixOS and non-NixOS systems, since NixOS already provides libGL to applications without the
need for nixGL.
'';
};
@ -35,7 +51,8 @@ in {
# a new debug output to be produced. We won't be producing any debug info
# for the original package.
separateDebugInfo = false;
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ pkgs.makeWrapper ];
nativeBuildInputs = old.nativeBuildInputs or [ ]
++ [ pkgs.makeWrapper ];
buildCommand = ''
set -eo pipefail