mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-05 17:27:50 +00:00
[Programs/Nvtop] refactor to intelligently enable the required backends
This commit is contained in:
parent
5fa9147e02
commit
d9ea216ea8
5 changed files with 23 additions and 9 deletions
|
|
@ -27,7 +27,10 @@ in {
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
aviallon.programs.nvtop.enable = true;
|
||||
aviallon.programs.nvtop = {
|
||||
enable = true;
|
||||
backend = [ "amd" ];
|
||||
};
|
||||
|
||||
hardware.opengl = {
|
||||
enable = true;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,10 @@ in
|
|||
];
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
aviallon.programs.nvtop.enable = true;
|
||||
aviallon.programs.nvtop = {
|
||||
enable = true;
|
||||
backend = [ "intel" ];
|
||||
};
|
||||
|
||||
boot.initrd.kernelModules = [ "i915" ];
|
||||
hardware.opengl = {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
hardware.opengl.driSupport32Bit = true;
|
||||
|
||||
aviallon.programs.nvtop.enable = true;
|
||||
aviallon.programs.nvtop = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
aviallon.hardware.nvidia.useProprietary = mkForce ( cfg.variant == "proprietary" );
|
||||
};
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ in {
|
|||
versionOlder hardwareCfg.nvidia.package.version "490.29.05" # https://www.nvidia.com/download/driverResults.aspx/181159/en-us/
|
||||
);
|
||||
|
||||
aviallon.programs.nvtop.nvidia = true;
|
||||
aviallon.programs.nvtop.backend = [ "nvidia" ];
|
||||
|
||||
boot.extraModprobeConfig = ''
|
||||
options nvidia NVreg_RegistryDwords="${concatStringsSep ";" cfg.proprietary.registryDwords}"
|
||||
|
|
@ -152,10 +152,6 @@ in {
|
|||
nvidia-vaapi-driver
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
nvtop
|
||||
];
|
||||
|
||||
# See documentation here: https://download.nvidia.com/XFree86/Linux-x86_64/510.60.02/README/openglenvvariables.html
|
||||
environment.variables = {
|
||||
"__GL_YIELD" = "USLEEP"; # use usleep(0) instead of sched_yield() -> better performance in most cases
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@ let
|
|||
in {
|
||||
options.aviallon.programs.nvtop = {
|
||||
enable = mkEnableOption "nvtop";
|
||||
backend = mkOption {
|
||||
description = "Which backend to enable";
|
||||
type = with types; listOf (enum [ "nvidia" "amd" "intel" "panthor" "panfrost" "msm" ]);
|
||||
default = [ "amd" ];
|
||||
};
|
||||
|
||||
nvidia = mkEnableOption "Nvidia GPU with proprietary drivers is used";
|
||||
package = mkOption {
|
||||
internal = true;
|
||||
|
|
@ -16,7 +22,11 @@ in {
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
# If an Nvidia GPU is used, use the full nvtop package
|
||||
aviallon.programs.nvtop.package = mkIf cfg.nvidia pkgs.nvtop;
|
||||
aviallon.programs.nvtop.package = mkDefault (
|
||||
if (length cfg.backend > 1) then
|
||||
pkgs.nvtopPackages.full
|
||||
else pkgs.nvtopPackages.${elemAt cfg.backend 0}
|
||||
);
|
||||
|
||||
environment.systemPackages = [
|
||||
cfg.package
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue