1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-21 16:31:10 +01:00

nixgl: move under targets.genericLinux

This commit is contained in:
Jure Varlec 2025-11-04 16:49:33 +01:00
parent 1cff905a33
commit 0807c25768
4 changed files with 18 additions and 13 deletions

View file

@ -7,7 +7,8 @@ can be integrated into Home Manager.
To enable the integration, import NixGL into your home configuration, either as
a channel, or as a flake input passed via `extraSpecialArgs`. Then, set the
`nixGL.packages` option to the package set provided by NixGL.
`targets.genericLinux.nixGL.packages` option to the package set provided by
NixGL.
Once integration is enabled, it can be used in two ways: as Nix functions for
wrapping programs installed via Home Manager, and as shell commands for running
@ -35,10 +36,11 @@ different hardware. There is also the `config.lib.nixGL.wrapOffload` alias for
two-GPU systems.
Another convenience is that all wrapper functions are always available. However,
when `nixGL.packages` option is unset, they are no-ops. This allows them to be
used even when the home configuration is used on NixOS machines. The exception
is the `prime-offload` script which ignores `nixGL.packages` and is installed
into the environment whenever `nixGL.prime.installScript` is set. This script,
when `targets.genericLinux.nixGL.packages` option is unset, they are no-ops.
This allows them to be used even when the home configuration is used on NixOS
machines. The exception is the `prime-offload` script which ignores
`targets.genericLinux.nixGL.packages` and is installed into the environment
whenever `targets.genericLinux.nixGL.prime.installScript` is set. This script,
which can be used to start a program on a secondary GPU, does not depend on
NixGL and is useful on NixOS systems as well.
@ -52,10 +54,12 @@ demonstration purposes.
```nix
{ config, lib, pkgs, nixgl, ... }:
{
nixGL.packages = nixgl.packages;
nixGL.defaultWrapper = "mesa";
nixGL.offloadWrapper = "nvidiaPrime";
nixGL.installScripts = [ "mesa" "nvidiaPrime" ];
targets.genericLinux.nixGL = {
packages = nixgl.packages;
defaultWrapper = "mesa";
offloadWrapper = "nvidiaPrime";
installScripts = [ "mesa" "nvidiaPrime" ];
};
programs.mpv = {
enable = true;
@ -75,7 +79,7 @@ flake. When using channels, the example would instead begin with
```nix
{ config, lib, pkgs, ... }:
{
nixGL.packages = import <nixgl> { inherit pkgs; };
targets.genericLinux.nixGL.packages = import <nixgl> { inherit pkgs; };
# The rest is the same as above
...
```

View file

@ -36,7 +36,6 @@ let
./misc/news.nix
./misc/nix-remote-build.nix
./misc/nix.nix
./misc/nixgl.nix
./misc/numlock.nix
./misc/pam.nix
./misc/qt.nix

View file

@ -24,6 +24,8 @@ in
"data"
]
)
(lib.mkRenamedOptionModule [ "nixGL" ] [ "targets" "genericLinux" "nixGL" ])
./generic-linux/nixgl.nix
];
options.targets.genericLinux = {

View file

@ -6,7 +6,7 @@
}:
let
cfg = config.nixGL;
cfg = config.targets.genericLinux.nixGL;
wrapperAttrNames = [
"mesa"
@ -21,7 +21,7 @@ in
{
meta.maintainers = [ lib.maintainers.smona ];
options.nixGL = {
options.targets.genericLinux.nixGL = {
packages = lib.mkOption {
type = with lib.types; nullOr attrs;
default = null;