diff --git a/hosts/ooksdesk/hardware.nix b/hosts/ooksdesk/hardware.nix index 703abeb..94e6c27 100644 --- a/hosts/ooksdesk/hardware.nix +++ b/hosts/ooksdesk/hardware.nix @@ -14,7 +14,6 @@ width = 2560; height = 1440; refreshRate = 144; - workspace = "1"; x = 1920; y = 100; } diff --git a/hosts/ooksmedia/hardware.nix b/hosts/ooksmedia/hardware.nix index bc4629e..6ed6778 100644 --- a/hosts/ooksmedia/hardware.nix +++ b/hosts/ooksmedia/hardware.nix @@ -10,7 +10,6 @@ width = 1920; height = 1080; refreshRate = 180; - workspace = "1"; } ]; }; diff --git a/hosts/ookst480s/hardware.nix b/hosts/ookst480s/hardware.nix index d67061d..73dff74 100644 --- a/hosts/ookst480s/hardware.nix +++ b/hosts/ookst480s/hardware.nix @@ -16,7 +16,6 @@ name = "eDP-1"; width = 1920; height = 1080; - workspace = "1"; } ]; }; diff --git a/modules/nixos/hardware/options.nix b/modules/nixos/hardware/options.nix index 44a4a36..864eba3 100644 --- a/modules/nixos/hardware/options.nix +++ b/modules/nixos/hardware/options.nix @@ -3,9 +3,14 @@ config, ... }: let + inherit (builtins) filter length head; inherit (lib) mkOption mkEnableOption; inherit (lib.types) nullOr enum bool submodule listOf int str; - inherit (config.ooknet) hardware; + + cfg = config.ooknet.hardware; + hasMonitors = length cfg.monitors != 0; + primaryAttr = filter (m: m.primary or false) cfg.monitors; + primaryCount = length primaryAttr; in { options.ooknet.hardware = { gpu = { @@ -21,10 +26,14 @@ in { default = null; }; amd.pstate.enable = mkEnableOption ""; - cores = { + cores = mkOption { type = int; description = "Number of Physical CPU cores the system has"; }; + threads = mkOption { + type = int; + description = "Number of cpu threads the cpu has"; + }; }; features = mkOption { @@ -43,6 +52,15 @@ in { # monitor module inspired by misterio77 # includes the addition of transform option + primaryMonitor = mkOption { + type = nullOr str; + default = + if !hasMonitors + then null + else (head primaryAttr).name; + description = "Name of the primary monitor, derived from the monitors list"; + readOnly = true; + }; monitors = mkOption { type = listOf (submodule { options = { @@ -82,10 +100,6 @@ in { type = bool; default = true; }; - workspace = mkOption { - type = nullOr str; - default = null; - }; }; }); default = []; @@ -95,10 +109,8 @@ in { config = { assertions = [ { - assertion = - ((lib.length hardware.monitors) != 0) - -> ((lib.length (lib.filter (m: m.primary) hardware.monitors)) == 1); - message = "At least 1 primary monitor is required"; + assertion = hasMonitors -> primaryCount == 1; + message = "Error: config.ooknet.hardware.monitors. When monitors are configured, exactly one monitor must be designated as primary (found ${toString primaryCount} primary monitors)"; } ]; };