hardware/gpu: add gpu module
This commit is contained in:
parent
c634a13ac3
commit
d71ee4073c
9 changed files with 59 additions and 52 deletions
|
@ -8,10 +8,6 @@
|
||||||
(with profiles; [
|
(with profiles; [
|
||||||
networking.wireless
|
networking.wireless
|
||||||
|
|
||||||
(with hardware; [
|
|
||||||
gpu.nvidia
|
|
||||||
])
|
|
||||||
|
|
||||||
btrfs
|
btrfs
|
||||||
virtualization
|
virtualization
|
||||||
|
|
||||||
|
@ -28,6 +24,7 @@
|
||||||
modules = {
|
modules = {
|
||||||
boot.grub.enable = true;
|
boot.grub.enable = true;
|
||||||
hardware = {
|
hardware = {
|
||||||
|
gpu.nvidia = true;
|
||||||
wireless.enable = true;
|
wireless.enable = true;
|
||||||
form.desktop = true;
|
form.desktop = true;
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,10 +5,6 @@
|
||||||
(with profiles; [
|
(with profiles; [
|
||||||
networking.wireless
|
networking.wireless
|
||||||
|
|
||||||
(with hardware; [
|
|
||||||
gpu.intel
|
|
||||||
])
|
|
||||||
|
|
||||||
# services.privoxy
|
# services.privoxy
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -44,6 +40,7 @@
|
||||||
modules = {
|
modules = {
|
||||||
boot.grub.enable = true;
|
boot.grub.enable = true;
|
||||||
hardware = {
|
hardware = {
|
||||||
|
gpu.intel = true;
|
||||||
form.laptop = true;
|
form.laptop = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
{ suites, profiles, pkgs, lib, ... }: {
|
{ suites, profiles, pkgs, lib, ... }: {
|
||||||
imports = lib.our.flattenListSet {
|
imports = lib.our.flattenListSet {
|
||||||
suites = with suites; [ base ];
|
suites = with suites; [ base ];
|
||||||
imports = [ ];
|
|
||||||
profiles = with profiles; [
|
|
||||||
hardware.gpu.nvidia
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
modules = {
|
modules = {
|
||||||
boot.grub.enable = true;
|
boot.grub.enable = true;
|
||||||
hardware.form.server = true;
|
hardware = {
|
||||||
|
gpu.nvidia = true;
|
||||||
|
form.server = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,11 @@ in
|
||||||
})
|
})
|
||||||
(mkIf cfg.portable {
|
(mkIf cfg.portable {
|
||||||
modules.hardware = {
|
modules.hardware = {
|
||||||
|
gpu = {
|
||||||
|
nvidia = mkDefault true;
|
||||||
|
intel = mkDefault true;
|
||||||
|
amdgpu = mkDefault true;
|
||||||
|
};
|
||||||
wireless.enable = mkDefault true;
|
wireless.enable = mkDefault true;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
48
modules/modules/hardware/gpu.nix
Normal file
48
modules/modules/hardware/gpu.nix
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
with lib;
|
||||||
|
with lib.hlissner;
|
||||||
|
let
|
||||||
|
cfg = config.modules.hardware.gpu;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.hardware.gpu = {
|
||||||
|
amdgpu = mkBoolOpt false;
|
||||||
|
nvidia = mkBoolOpt false;
|
||||||
|
intel = mkBoolOpt false;
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkMerge [
|
||||||
|
(mkIf (any (with cfg; [ amdgpu nvidia intel ])) {
|
||||||
|
hardware.opengl = {
|
||||||
|
enable = true;
|
||||||
|
driSupport = true;
|
||||||
|
driSupport32Bit = true;
|
||||||
|
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
vaapiVdpau
|
||||||
|
libvdpau-va-gl
|
||||||
|
];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.amdgpu {
|
||||||
|
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||||
|
services.xserver.videoDrivers = [ "amdgpu" ];
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.nvidia {
|
||||||
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
|
|
||||||
|
hardware.nvidia = {
|
||||||
|
modesetting.enable = true;
|
||||||
|
powerManagement.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualisation.docker.enableNvidia = true;
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.intel {
|
||||||
|
hardware.opengl.extraPackages = with pkgs; [ intel-media-driver vaapiIntel ];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
|
@ -1,7 +0,0 @@
|
||||||
{ ... }: {
|
|
||||||
imports = [ ./common.nix ];
|
|
||||||
|
|
||||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
|
||||||
|
|
||||||
services.xserver.videoDrivers = [ "amdgpu" ];
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
{ pkgs, ... }: {
|
|
||||||
hardware.opengl = {
|
|
||||||
enable = true;
|
|
||||||
driSupport = true;
|
|
||||||
driSupport32Bit = true;
|
|
||||||
|
|
||||||
extraPackages = with pkgs; [
|
|
||||||
vaapiVdpau
|
|
||||||
libvdpau-va-gl
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
{ pkgs, ... }: {
|
|
||||||
imports = [ ./common.nix ];
|
|
||||||
|
|
||||||
hardware.opengl.extraPackages = with pkgs; [
|
|
||||||
intel-media-driver
|
|
||||||
vaapiIntel
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
{ ... }: {
|
|
||||||
imports = [ ./common.nix ];
|
|
||||||
|
|
||||||
services.xserver.videoDrivers = [ "nvidia" ];
|
|
||||||
|
|
||||||
hardware.nvidia = {
|
|
||||||
modesetting.enable = true;
|
|
||||||
powerManagement.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
virtualisation.docker.enableNvidia = true;
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue