Parameterise gpu config

This commit is contained in:
Simon Bruder 2020-12-05 15:57:23 +01:00
parent 9b22c91170
commit 76bd3a4bc8
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F
6 changed files with 50 additions and 30 deletions

View file

@ -5,13 +5,13 @@
[ [
./hardware-configuration.nix ./hardware-configuration.nix
../../modules/cpu/intel.nix ../../modules/cpu/intel.nix
../../modules/gpu/intel.nix
../../modules ../../modules
../../profiles/dev.nix ../../profiles/dev.nix
../../users/simon ../../users/simon
]; ];
sbruder = { sbruder = {
gpu.intel.enable = true;
gui.enable = true; gui.enable = true;
libvirt.enable = true; libvirt.enable = true;
restic.enable = true; restic.enable = true;

View file

@ -5,13 +5,13 @@
[ [
./hardware-configuration.nix ./hardware-configuration.nix
../../modules/cpu/intel.nix ../../modules/cpu/intel.nix
../../modules/gpu/amd.nix
../../modules ../../modules
../../profiles/dev.nix ../../profiles/dev.nix
../../users/simon ../../users/simon
]; ];
sbruder = { sbruder = {
gpu.amd.enable = true;
gui.enable = true; gui.enable = true;
libvirt.enable = true; libvirt.enable = true;
restic.enable = true; restic.enable = true;

View file

@ -14,6 +14,7 @@
./cups.nix ./cups.nix
./docker.nix ./docker.nix
./fonts.nix ./fonts.nix
./gpu
./grub.nix ./grub.nix
./libvirt.nix ./libvirt.nix
./locales.nix ./locales.nix

View file

@ -1,6 +1,11 @@
{ pkgs, ... }: { config, lib, pkgs, ... }:
let
cfg = config.sbruder.gpu.amd;
in
{ {
options.sbruder.gpu.amd.enable = lib.mkEnableOption "amd gpu configuration";
config = lib.mkIf cfg.enable {
hardware.opengl.extraPackages = with pkgs; [ hardware.opengl.extraPackages = with pkgs; [
amdvlk amdvlk
rocm-opencl-icd rocm-opencl-icd
@ -23,4 +28,5 @@
# }; # };
# } # }
#]; #];
};
} }

7
modules/gpu/default.nix Normal file
View file

@ -0,0 +1,7 @@
{ lib, ... }:
{
imports = [
./amd.nix
./intel.nix
];
}

View file

@ -1,8 +1,14 @@
{ pkgs, ... }: { config, lib, pkgs, ... }:
let
cfg = config.sbruder.gpu.intel;
in
{ {
options.sbruder.gpu.intel.enable = lib.mkEnableOption "intel gpu configuration";
config = lib.mkIf cfg.enable {
hardware.opengl.extraPackages = with pkgs; [ hardware.opengl.extraPackages = with pkgs; [
beignet beignet
vaapiIntel vaapiIntel
]; ];
};
} }