things
This commit is contained in:
@@ -4,100 +4,90 @@
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption mkOption mkMerge optional;
|
||||
inherit (lib) mkIf mkOption types mkEnableOption mkMerge;
|
||||
cfg = config.nixos.hardware.graphics.amd;
|
||||
in {
|
||||
options = {
|
||||
nixos.hardware.graphics.amd = {
|
||||
enable = mkEnableOption "Enables AMD graphics";
|
||||
enable = mkEnableOption "AMD graphics support";
|
||||
|
||||
extraPackages = mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Whether to install AMD-specific extra packages.";
|
||||
};
|
||||
|
||||
chaotic = {
|
||||
enable = mkEnableOption "Enables chaotic mesa version";
|
||||
extraPackages = mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Whether to install AMD-specific chaotic extra packages.";
|
||||
};
|
||||
packageSet = mkOption {
|
||||
type = types.enum ["standard" "chaotic" "minimal"];
|
||||
default = "minimal";
|
||||
description = ''
|
||||
Which set of AMD graphics packages to use:
|
||||
- minimal: Only basic drivers and libraries
|
||||
- standard: Additional AMD-specific tools and utilities
|
||||
- chaotic: Chaotic Mesa git version with additional optimizations
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
assertions = [
|
||||
{
|
||||
assertion = !(cfg.extraPackages && cfg.chaotic.extraPackages);
|
||||
message = ''
|
||||
Only one type of extraPackages can be set to true at the same time.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
# Base configuration that applies regardless of package set
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
};
|
||||
}
|
||||
|
||||
extraPackages = optional cfg.extraPackages (with pkgs; [
|
||||
(mkIf (cfg.packageSet == "standard") {
|
||||
hardware.graphics = {
|
||||
extraPackages = with pkgs; [
|
||||
libva
|
||||
vaapiVdpau
|
||||
libvdpau-va-gl
|
||||
amdvlk
|
||||
vulkan-tools
|
||||
]);
|
||||
|
||||
extraPackages32 = optional cfg.extraPackages (with pkgs.pkgsi686Linux; [
|
||||
];
|
||||
extraPackages32 = with pkgs.pkgsi686Linux; [
|
||||
vaapiVdpau
|
||||
libvdpau-va-gl
|
||||
]);
|
||||
];
|
||||
};
|
||||
}
|
||||
(mkIf cfg.chaotic.enable (mkMerge [
|
||||
{
|
||||
chaotic.scx.enable = true;
|
||||
}
|
||||
(mkIf cfg.chaotic.extraPackages {
|
||||
chaotic = {
|
||||
scx.scheduler = "scx_lavd";
|
||||
mesa-git = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [
|
||||
libva
|
||||
libvdpau-va-gl
|
||||
vaapiVdpau
|
||||
libdrm_git
|
||||
latencyflex-vulkan
|
||||
mesa_git
|
||||
mesa_git.opencl
|
||||
vulkanPackages_latest.gfxreconstruct
|
||||
vulkanPackages_latest.spirv-cross
|
||||
vulkanPackages_latest.spirv-headers
|
||||
vulkanPackages_latest.spirv-tools
|
||||
vulkanPackages_latest.vulkan-extension-layer
|
||||
vulkanPackages_latest.vulkan-headers
|
||||
vulkanPackages_latest.vulkan-loader
|
||||
vulkanPackages_latest.vulkan-tools
|
||||
vulkanPackages_latest.vulkan-tools-lunarg
|
||||
vulkanPackages_latest.vulkan-utility-libraries
|
||||
vulkanPackages_latest.vulkan-validation-layers
|
||||
vulkanPackages_latest.vulkan-volk
|
||||
];
|
||||
extraPackages32 = with pkgs.pkgsi686Linux; [
|
||||
pkgs.mesa32_git
|
||||
pkgs.mesa32_git.opencl
|
||||
libdrm32_git
|
||||
libva
|
||||
libvdpau-va-gl
|
||||
vaapiVdpau
|
||||
];
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf (cfg.packageSet == "chaotic") {
|
||||
chaotic = {
|
||||
scx = {
|
||||
enable = true;
|
||||
scheduler = "scx_lavd";
|
||||
};
|
||||
})
|
||||
]))
|
||||
mesa-git = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [
|
||||
libva
|
||||
libvdpau-va-gl
|
||||
vaapiVdpau
|
||||
libdrm_git
|
||||
latencyflex-vulkan
|
||||
mesa_git
|
||||
mesa_git.opencl
|
||||
vulkanPackages_latest.gfxreconstruct
|
||||
vulkanPackages_latest.spirv-cross
|
||||
vulkanPackages_latest.spirv-headers
|
||||
vulkanPackages_latest.spirv-tools
|
||||
vulkanPackages_latest.vulkan-extension-layer
|
||||
vulkanPackages_latest.vulkan-headers
|
||||
vulkanPackages_latest.vulkan-loader
|
||||
vulkanPackages_latest.vulkan-tools
|
||||
vulkanPackages_latest.vulkan-tools-lunarg
|
||||
vulkanPackages_latest.vulkan-utility-libraries
|
||||
vulkanPackages_latest.vulkan-validation-layers
|
||||
vulkanPackages_latest.vulkan-volk
|
||||
];
|
||||
extraPackages32 = with pkgs.pkgsi686Linux; [
|
||||
pkgs.mesa32_git
|
||||
pkgs.mesa32_git.opencl
|
||||
libdrm32_git
|
||||
libva
|
||||
libvdpau-va-gl
|
||||
vaapiVdpau
|
||||
];
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -7,44 +7,50 @@
|
||||
cfg = config.nixos.hardware.network;
|
||||
in {
|
||||
options = {
|
||||
nixos = {
|
||||
hardware = {
|
||||
network = {
|
||||
enable = mkEnableOption "Enable the custom networking module";
|
||||
|
||||
hostName = mkOption {
|
||||
type = types.str;
|
||||
default = "default-hostname";
|
||||
description = "Hostname for the nixos.";
|
||||
};
|
||||
|
||||
interfaces = mkOption {
|
||||
type = types.attrsOf (types.submodule {
|
||||
options = {
|
||||
allowedTCPPorts = mkOption {
|
||||
type = types.listOf types.int;
|
||||
default = [];
|
||||
description = "List of allowed TCP ports for this interface.";
|
||||
};
|
||||
};
|
||||
});
|
||||
default = {};
|
||||
description = "Network interface configurations.";
|
||||
};
|
||||
nm-applet = {
|
||||
enable = mkEnableOption "Enables the nm-applet service.";
|
||||
indicator = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enables the nm-applet indicator.";
|
||||
nixos.hardware.network = {
|
||||
enable = mkEnableOption "Enable the custom networking module";
|
||||
hostName = mkOption {
|
||||
type = types.str;
|
||||
default = "default-hostname";
|
||||
description = "Hostname for the nixos.";
|
||||
};
|
||||
interfaces = mkOption {
|
||||
type = types.attrsOf (types.submodule {
|
||||
options = {
|
||||
allowedTCPPorts = mkOption {
|
||||
type = types.listOf types.int;
|
||||
default = [];
|
||||
description = "List of allowed TCP ports for this interface.";
|
||||
};
|
||||
allowedUDPPorts = mkOption {
|
||||
type = types.listOf types.int;
|
||||
default = [];
|
||||
description = "List of allowed UDP ports for this interface.";
|
||||
};
|
||||
};
|
||||
});
|
||||
default = {};
|
||||
description = "Network interface configurations.";
|
||||
};
|
||||
nm-applet = {
|
||||
enable = mkEnableOption "Enables the nm-applet service.";
|
||||
indicator = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enables the nm-applet indicator.";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.interfaces != {} -> config.networking.networkmanager.enable;
|
||||
message = "Network interfaces configured but NetworkManager is not enabled";
|
||||
}
|
||||
];
|
||||
|
||||
networking = {
|
||||
networkmanager.enable = true;
|
||||
inherit (cfg) hostName;
|
||||
@@ -54,6 +60,12 @@ in {
|
||||
inherit (cfg) interfaces;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.NetworkManager = {
|
||||
wants = ["nftables.service"];
|
||||
after = ["nftables.service"];
|
||||
};
|
||||
|
||||
programs.nm-applet = {
|
||||
enable = cfg.nm-applet.enable;
|
||||
indicator = cfg.nm-applet.indicator;
|
||||
|
||||
Reference in New Issue
Block a user