mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-22 00:41:12 +01:00
nixgl: move under targets.genericLinux
This commit is contained in:
parent
1cff905a33
commit
0807c25768
4 changed files with 18 additions and 13 deletions
|
|
@ -7,7 +7,8 @@ can be integrated into Home Manager.
|
||||||
|
|
||||||
To enable the integration, import NixGL into your home configuration, either as
|
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
|
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
|
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
|
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.
|
two-GPU systems.
|
||||||
|
|
||||||
Another convenience is that all wrapper functions are always available. However,
|
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
|
when `targets.genericLinux.nixGL.packages` option is unset, they are no-ops.
|
||||||
used even when the home configuration is used on NixOS machines. The exception
|
This allows them to be used even when the home configuration is used on NixOS
|
||||||
is the `prime-offload` script which ignores `nixGL.packages` and is installed
|
machines. The exception is the `prime-offload` script which ignores
|
||||||
into the environment whenever `nixGL.prime.installScript` is set. This script,
|
`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
|
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.
|
NixGL and is useful on NixOS systems as well.
|
||||||
|
|
||||||
|
|
@ -52,10 +54,12 @@ demonstration purposes.
|
||||||
```nix
|
```nix
|
||||||
{ config, lib, pkgs, nixgl, ... }:
|
{ config, lib, pkgs, nixgl, ... }:
|
||||||
{
|
{
|
||||||
nixGL.packages = nixgl.packages;
|
targets.genericLinux.nixGL = {
|
||||||
nixGL.defaultWrapper = "mesa";
|
packages = nixgl.packages;
|
||||||
nixGL.offloadWrapper = "nvidiaPrime";
|
defaultWrapper = "mesa";
|
||||||
nixGL.installScripts = [ "mesa" "nvidiaPrime" ];
|
offloadWrapper = "nvidiaPrime";
|
||||||
|
installScripts = [ "mesa" "nvidiaPrime" ];
|
||||||
|
};
|
||||||
|
|
||||||
programs.mpv = {
|
programs.mpv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -75,7 +79,7 @@ flake. When using channels, the example would instead begin with
|
||||||
```nix
|
```nix
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
{
|
{
|
||||||
nixGL.packages = import <nixgl> { inherit pkgs; };
|
targets.genericLinux.nixGL.packages = import <nixgl> { inherit pkgs; };
|
||||||
# The rest is the same as above
|
# The rest is the same as above
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ let
|
||||||
./misc/news.nix
|
./misc/news.nix
|
||||||
./misc/nix-remote-build.nix
|
./misc/nix-remote-build.nix
|
||||||
./misc/nix.nix
|
./misc/nix.nix
|
||||||
./misc/nixgl.nix
|
|
||||||
./misc/numlock.nix
|
./misc/numlock.nix
|
||||||
./misc/pam.nix
|
./misc/pam.nix
|
||||||
./misc/qt.nix
|
./misc/qt.nix
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@ in
|
||||||
"data"
|
"data"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
(lib.mkRenamedOptionModule [ "nixGL" ] [ "targets" "genericLinux" "nixGL" ])
|
||||||
|
./generic-linux/nixgl.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
options.targets.genericLinux = {
|
options.targets.genericLinux = {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.nixGL;
|
cfg = config.targets.genericLinux.nixGL;
|
||||||
|
|
||||||
wrapperAttrNames = [
|
wrapperAttrNames = [
|
||||||
"mesa"
|
"mesa"
|
||||||
|
|
@ -21,7 +21,7 @@ in
|
||||||
{
|
{
|
||||||
meta.maintainers = [ lib.maintainers.smona ];
|
meta.maintainers = [ lib.maintainers.smona ];
|
||||||
|
|
||||||
options.nixGL = {
|
options.targets.genericLinux.nixGL = {
|
||||||
packages = lib.mkOption {
|
packages = lib.mkOption {
|
||||||
type = with lib.types; nullOr attrs;
|
type = with lib.types; nullOr attrs;
|
||||||
default = null;
|
default = null;
|
||||||
Loading…
Add table
Add a link
Reference in a new issue