Adding proper imports, fixed rebuild alias, added amd driver module

This commit is contained in:
Tyler Kelley 2024-05-14 13:34:02 -05:00
parent de1687998d
commit 493e93f428
3 changed files with 45 additions and 1 deletions

View File

@ -14,6 +14,7 @@ in
imports = [
./hardware.nix
./users.nix
../../modules/amd-drivers.nix
];
# Bootloader.
@ -24,6 +25,14 @@ in
};
boot.tmp.useTmpfs = false;
boot.tmp.tmpfsSize = "30%";
boot.binfmt.registrations.appimage = {
wrapInterpreterInShell = false;
interpreter = "${pkgs.appimage-run}/bin/appimage-run";
recognitionType = "magic";
offset = 0;
mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff'';
magicOrExtension = ''\x7fELF....AI\x02'';
};
# This is for OBS Virtual Cam Support - v4l2loopback setup
boot.kernelModules = [ "v4l2loopback" ];
@ -215,6 +224,9 @@ in
driSupport32Bit = true;
};
# Extra Module Options
drivers.amdgpu.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];

View File

@ -29,6 +29,7 @@ in
inputs.nix-colors.homeManagerModules.default
inputs.hyprland.homeManagerModules.default
../../config/hyprland.nix
../../config/waybar.nix
];
# Define Settings For Xresources
@ -88,7 +89,7 @@ in
};
shellAliases = {
sv = "sudo nvim";
flake-rebuild = "nh os switch --hostname ${host}";
flake-rebuild = "nh os switch --hostname ${host} /home/${username}/zaneyos";
flake-update = "nh os switch --hostname ${host} --update";
gcCleanup = "nix-collect-garbage --delete-old && sudo nix-collect-garbage -d && sudo /run/current-system/bin/switch-to-configuration boot";
v = "nvim";

31
modules/amd-drivers.nix Normal file
View File

@ -0,0 +1,31 @@
{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.drivers.amdgpu;
in
{
# Declare what settings a user of this "hello.nix" module CAN SET.
options.drivers.amdgpu = {
enable = mkEnableOption "Enable AMD Drivers";
};
# Define what other settings, services and resources should be active IF
# a user of this "hello.nix" module ENABLED this module
# by setting "services.hello.enable = true;".
config = mkIf cfg.enable {
systemd.tmpfiles.rules = [ "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" ];
services.xserver.enable = true;
services.xserver.videoDrivers = [ "amdgpu" ];
# OpenGL
hardware.opengl = {
## amdvlk: an open-source Vulkan driver from AMD
extraPackages = [ pkgs.amdvlk ];
extraPackages32 = [ pkgs.driversi686Linux.amdvlk ];
};
};
}