1
1
Fork 0
nixos/options/custom/programs/nixgl.nix
Myned b6fa1ee221
programs: add nixgl
Signed-off-by: Myned <dev@bjork.tech>
2025-02-11 18:39:03 -06:00

41 lines
971 B
Nix

{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.custom.programs.nixgl;
in {
options.custom.programs.nixgl = {
enable = mkOption {default = false;};
wrapper = mkOption {default = "mesa";};
};
config = mkIf cfg.enable {
# https://github.com/nix-community/nixGL
#?? nixGL PROGRAM
environment.systemPackages = with pkgs.nixgl;
optionals (cfg.wrapper == "auto") [
#!! Impure autodetection
auto.nixGLDefault
]
++ optionals (cfg.wrapper == "mesa") [
nixGLIntel
nixVulkanIntel
# Wrapper for the wrappers
#?? nixgl PROGRAM
(pkgs.writeShellApplication {
name = "nixgl";
runtimeInputs = [nixGLIntel nixVulkanIntel];
text = ''exec nixGLIntel nixVulkanIntel "$@"'';
})
]
++ optionals (cfg.wrapper == "nvidia") [
#!! Impure autodetection
auto.nixGLNvidia
auto.nixVulkanNvidia
];
};
}