Split documentation into each file

This commit is contained in:
DashieTM 2024-08-28 22:04:46 +02:00
parent dfc4b5cf94
commit 4cd9e462d8
16 changed files with 205 additions and 187 deletions

View file

@ -8,32 +8,34 @@
}:
{
options.mods = {
default_base_packages = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = ''
Enables default system packages.
'';
};
additional_packages = lib.mkOption {
default = [ ];
example = [ pkgs.openssl ];
type = with lib.types; listOf package;
description = ''
Additional packages to install.
Note that these are installed even if base packages is disabled, e.g. you can also use this as the only packages to install.
'';
base_packages = {
default_base_packages = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = ''
Enables default system packages.
'';
};
additional_packages = lib.mkOption {
default = [ ];
example = [ pkgs.openssl ];
type = with lib.types; listOf package;
description = ''
Additional packages to install.
Note that these are installed even if base packages is disabled, e.g. you can also use this as the only packages to install.
'';
};
};
};
};
config = (
lib.optionalAttrs (options ? environment.systemPackages) {
environment.systemPackages = config.mods.default_base_packages.additional_packages;
environment.systemPackages = config.mods.base_packages.default_base_packages.additional_packages;
}
// (lib.mkIf config.mods.default_base_packages.enable (
// (lib.mkIf config.mods.base_packages.default_base_packages.enable (
lib.optionalAttrs (options ? environment.systemPackages) {
environment.systemPackages = with pkgs; [
adwaita-icon-theme

View file

@ -18,7 +18,7 @@
./kde_connect.nix
./keepassxc.nix
./kitty.nix
./layout.nix
./xkb.nix
./media.nix
./ncspot.nix
./nextcloud.nix

View file

@ -36,50 +36,52 @@ let
in
{
options.mods = {
useSwap = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = ''
Use default drive config
'';
drives = {
useSwap = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = ''
Use default drive config
'';
};
};
};
defaultDrives = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = ''
Use default drive config
'';
defaultDrives = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = ''
Use default drive config
'';
};
};
};
extraDrives = lib.mkOption {
default = [
extraDrives = lib.mkOption {
default = [
];
example = [
{
name = "drive2";
drive = {
device = "/dev/disk/by-label/DRIVE2";
fsType = "ext4";
options = [
"noatime"
"nodiratime"
"discard"
];
};
}
];
# TODO: how to make this work
# type = with lib.types; listOf (attrsOf driveModule);
type = with lib.types; listOf (attrsOf anything);
description = ''
Extra drives to add.
'';
];
example = [
{
name = "drive2";
drive = {
device = "/dev/disk/by-label/DRIVE2";
fsType = "ext4";
options = [
"noatime"
"nodiratime"
"discard"
];
};
}
];
# TODO: how to make this work
# type = with lib.types; listOf (attrsOf driveModule);
type = with lib.types; listOf (attrsOf anything);
description = ''
Extra drives to add.
'';
};
};
};
@ -93,9 +95,9 @@ in
name = "/" + name;
value = drive;
}
) config.mods.extraDrives
) config.mods.drives.extraDrives
)
// (lib.optionalAttrs config.mods.defaultDrives.enable) {
// (lib.optionalAttrs config.mods.drives.defaultDrives.enable) {
"/" = {
device = "/dev/disk/by-label/ROOT";
fsType = "btrfs";
@ -128,7 +130,7 @@ in
};
};
# TODO make this convert to choice of drives -> thanks to funny types this doesn't work...
swapDevices = lib.mkIf config.mods.useSwap.enable [ { device = "/dev/disk/by-label/SWAP"; } ];
swapDevices = lib.mkIf config.mods.drives.useSwap.enable [ { device = "/dev/disk/by-label/SWAP"; } ];
}
);
}

View file

@ -8,47 +8,49 @@
{
options.mods = {
nvidia.enable = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = ''
Enables nvidia support.
'';
};
amdgpu.enable = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = ''
Enables amdgpu support.
'';
};
intelgpu.enable = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = ''
Enables intel support.
'';
};
vapi = {
enable = lib.mkOption {
default = true;
example = false;
gpu = {
nvidia.enable = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = ''
Enables vapi.
Enables nvidia support.
'';
};
rocm.enable = lib.mkOption {
amdgpu.enable = lib.mkOption {
default = false;
type = lib.types.bool;
example = true;
type = lib.types.bool;
description = ''
Enables rocm support.
Enables amdgpu support.
'';
};
intelgpu.enable = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = ''
Enables intel support.
'';
};
vapi = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = ''
Enables vapi.
'';
};
rocm.enable = lib.mkOption {
default = false;
type = lib.types.bool;
example = true;
description = ''
Enables rocm support.
'';
};
};
};
};
@ -64,11 +66,13 @@
graphics =
let
amdPackages = [
(lib.mkIf (config.mods.intelgpu && lib.mkIf config.mods.vapi.enable) pkgs.vpl-gpu-rt)
(lib.mkIf (config.mods.intelgpu && lib.mkIf config.mods.vapi.enable) pkgs.intel-media-driver)
(lib.mkIf config.mods.vapi.enable pkgs.libvdpau-va-gl)
(lib.mkIf config.mods.vapi.enable pkgs.vaapiVdpau)
(lib.mkIf (config.mods.intelgpu || config.mods.amdgpu) pkgs.mesa.drivers)
(lib.mkIf (config.mods.gpu.intelgpu && lib.mkIf config.mods.gpu.vapi.enable) pkgs.vpl-gpu-rt)
(lib.mkIf (
config.mods.gpu.intelgpu && lib.mkIf config.mods.gpu.vapi.enable
) pkgs.intel-media-driver)
(lib.mkIf config.mods.gpu.vapi.enable pkgs.libvdpau-va-gl)
(lib.mkIf config.mods.gpu.vapi.enable pkgs.vaapiVdpau)
(lib.mkIf (config.mods.gpu.intelgpu || config.mods.gpu.amdgpu) pkgs.mesa.drivers)
];
rocmPackages = [
pkgs.rocmPackages.clr.icd
@ -80,12 +84,12 @@
enable32Bit = lib.mkDefault true;
extraPackages =
amdPackages
++ (lib.lists.optionals (config.mods.vapi.rocm.enable && config.mods.gpu.amdgpu) rocmPackages);
++ (lib.lists.optionals (config.mods.gpu.vapi.rocm.enable && config.mods.gpu.amdgpu) rocmPackages);
};
};
})
// lib.optionalAttrs (options ? hardware.graphics) (
lib.mkIf config.mods.nvidia.enable {
lib.mkIf config.mods.gpu.nvidia.enable {
hardware.nvidia = {
modesetting.enable = true;
# powerManagement.enable = false;

View file

@ -254,7 +254,7 @@
cursor = {
# conversion seems to be borked right now, i want a smooth bibata :(
enable_hyprcursor = false;
no_hardware_cursors = lib.mkIf config.mods.nvidia.enable true;
no_hardware_cursors = lib.mkIf config.mods.gpu.nvidia.enable true;
# no_break_fs_vrr = true;
};
@ -285,10 +285,10 @@
(lib.mkIf config.mods.hyprland.no_atomic "WLR_DRM_NO_ATOMIC,1")
"GTK_USE_PORTAL, 1"
(lib.mkIf config.mods.nvidia.enable "LIBVA_DRIVER_NAME,nvidia")
(lib.mkIf config.mods.nvidia.enable "XDG_SESSION_TYPE,wayland")
(lib.mkIf config.mods.nvidia.enable "GBM_BACKEND,nvidia-drm")
(lib.mkIf config.mods.nvidia.enable "__GLX_VENDOR_LIBRARY_NAME,nvidia")
(lib.mkIf config.mods.gpu.nvidia.enable "LIBVA_DRIVER_NAME,nvidia")
(lib.mkIf config.mods.gpu.nvidia.enable "XDG_SESSION_TYPE,wayland")
(lib.mkIf config.mods.gpu.nvidia.enable "GBM_BACKEND,nvidia-drm")
(lib.mkIf config.mods.gpu.nvidia.enable "__GLX_VENDOR_LIBRARY_NAME,nvidia")
];
layerrule = [

View file

@ -6,7 +6,7 @@
...
}:
{
options.mods.media_packages = {
options.mods.media = {
useBasePackages = lib.mkOption {
default = true;
example = false;
@ -24,9 +24,9 @@
};
config = (
lib.optionalAttrs (options ? home.packages) {
home.packages = config.mods.media_packages.additionalPackages;
home.packages = config.mods.media.additionalPackages;
}
// (lib.mkIf config.mods.media_packages.useBasePackages (
// (lib.mkIf config.mods.media.useBasePackages (
lib.optionalAttrs (options ? home.packages) {
home.packages = with pkgs; [
# base audio