diff --git a/hosts/MaxNixosLaptop/configuration.nix b/hosts/MaxNixosLaptop/configuration.nix index 4d4d888..6dfd67f 100644 --- a/hosts/MaxNixosLaptop/configuration.nix +++ b/hosts/MaxNixosLaptop/configuration.nix @@ -17,21 +17,10 @@ myConfig = { enable = true; desktop = true; + gpu.amd.enable = true; laptop = true; }; - hardware.opengl = { - enable = true; - extraPackages = with pkgs; [ - libvdpau-va-gl - libvdpau - libva - rocmPackages.clr.icd - amdvlk - driversi686Linux.amdvlk - ]; - }; - networking.hostName = "MaxNixosLaptop"; # Define your hostname. # NIXOS @@ -161,8 +150,6 @@ ''; }; - services.flatpak.enable = true; - services.pipewire = { enable = true; alsa.enable = true; diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index b2a154a..b2f45f0 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -5,7 +5,7 @@ }: let cfg = config.myConfig; in { - imports = [./bootloader.nix ./locale.nix ./greetd.nix ./rebuild.nix ./sops.nix ./sway.nix ./wifi.nix ./music.nix ./cups.nix]; + imports = [./bootloader.nix ./locale.nix ./greetd.nix ./rebuild.nix ./sops.nix ./sway.nix ./wifi.nix ./music.nix ./cups.nix ./gpu/amd.nix]; options.myConfig = { enable = lib.mkEnableOption "my custom config"; diff --git a/modules/nixos/gpu/amd.nix b/modules/nixos/gpu/amd.nix new file mode 100644 index 0000000..e7845a8 --- /dev/null +++ b/modules/nixos/gpu/amd.nix @@ -0,0 +1,40 @@ +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.myConfig.gpu.amd; +in { + options.myConfig.gpu.amd = { + enable = lib.mkEnableOption "enable amd gpu hardware acceleration"; + }; + + config = lib.mkIf cfg.enable { + boot.initrd.kernelModules = ["amdgpu"]; + services.xserver.videoDrivers = ["amdgpu"]; + + systemd.tmpfiles.rules = [ + "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" + ]; + + hardware.opengl = { + enable = true; + extraPackages = with pkgs; [ + rocmPackages.clr.icd + amdvlk + ]; + extraPackages32 = with pkgs; [ + driversi686Linux.amdvlk + ]; + driSupport = true; + driSupport32Bit = true; + }; + + environment.systemPackages = with pkgs; [ + glxinfo + vulkan-tools + gpu-viewer + ]; + }; +}