mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Programs] Add nvtop config, with special handling for Nvidia GPUs
This commit is contained in:
parent
17180722c1
commit
1f0f8ba399
7 changed files with 34 additions and 7 deletions
|
|
@ -27,6 +27,8 @@ in {
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
aviallon.programs.nvtop.enable = true;
|
||||||
|
|
||||||
hardware.opengl = {
|
hardware.opengl = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,6 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
||||||
environment.systemPackages = []
|
|
||||||
++ optional (cfg.amd.enable && cfg.nvidia.enable) pkgs.nvtop
|
|
||||||
++ optional cfg.amd.enable pkgs.nvtop-amd
|
|
||||||
++ optional cfg.nvidia.enable pkgs.nvtop-nvidia
|
|
||||||
;
|
|
||||||
|
|
||||||
boot.kernel.sysctl = {
|
boot.kernel.sysctl = {
|
||||||
|
|
||||||
# Why: https://www.phoronix.com/news/Ryzen-Segv-Response
|
# Why: https://www.phoronix.com/news/Ryzen-Segv-Response
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
aviallon.programs.nvtop.enable = true;
|
||||||
|
|
||||||
boot.initrd.kernelModules = [ "i915" ];
|
boot.initrd.kernelModules = [ "i915" ];
|
||||||
hardware.opengl = {
|
hardware.opengl = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ in {
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
hardware.opengl.driSupport32Bit = true;
|
hardware.opengl.driSupport32Bit = true;
|
||||||
|
|
||||||
|
aviallon.programs.nvtop.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,8 @@ in {
|
||||||
nvidiaSettings = true;
|
nvidiaSettings = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
aviallon.programs.nvtop.nvidia = true;
|
||||||
|
|
||||||
aviallon.boot.cmdline = {}
|
aviallon.boot.cmdline = {}
|
||||||
// {
|
// {
|
||||||
"nvidia-drm.modeset" = 1;
|
"nvidia-drm.modeset" = 1;
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,6 @@
|
||||||
./bash.nix
|
./bash.nix
|
||||||
./git.nix
|
./git.nix
|
||||||
./nano.nix
|
./nano.nix
|
||||||
|
./nvtop.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
25
programs/nvtop.nix
Normal file
25
programs/nvtop.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
{ config, pkgs, lib, myLib, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.aviallon.programs.nvtop;
|
||||||
|
in {
|
||||||
|
options.aviallon.programs.nvtop = {
|
||||||
|
enable = mkEnableOption "nvtop";
|
||||||
|
nvidia = mkEnableOption "Nvidia GPU with proprietary drivers is used";
|
||||||
|
package = mkOption {
|
||||||
|
internal = true;
|
||||||
|
description = "Which nvtop package to use";
|
||||||
|
default = pkgs.nvtop-amd;
|
||||||
|
type = myLib.types.package';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# If an Nvidia GPU is used, use the full nvtop package
|
||||||
|
aviallon.programs.nvtop.package = mkIf cfg.nvidia pkgs.nvtop;
|
||||||
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
cfg.package
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue