refactor(nixos:host): move module options -> nixos/options/host.nix
This commit is contained in:
parent
20466f95b2
commit
1ac90d7985
11 changed files with 137 additions and 199 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkMerge mkEnableOption mkIf versionAtLeast versionOlder;
|
||||
inherit (lib) mkMerge mkIf versionAtLeast versionOlder;
|
||||
inherit (builtins) elem;
|
||||
cpu = config.ooknet.host.hardware.cpu;
|
||||
cfg = cpu.amd;
|
||||
|
|
@ -11,8 +11,6 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
options.ooknet.host.hardware.cpu.amd.pstate.enable = mkEnableOption "Enable amd pstate module";
|
||||
|
||||
config = mkIf (elem cpu.type ["amd"]) {
|
||||
environment.systemPackages = [pkgs.amdctl];
|
||||
hardware.cpu.amd.updateMicrocode = true;
|
||||
|
|
|
|||
|
|
@ -1,18 +1,6 @@
|
|||
{ lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) types mkOption;
|
||||
in
|
||||
|
||||
{
|
||||
imports = [
|
||||
./amd.nix
|
||||
./intel.nix
|
||||
];
|
||||
|
||||
options.ooknet.host.hardware.cpu.type = mkOption {
|
||||
type = with types; nullOr (enum ["intel" "amd"]);
|
||||
default = null;
|
||||
description = "Type of cpu system module to use";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,39 +4,12 @@
|
|||
let
|
||||
features = config.ooknet.host.hardware.features;
|
||||
cfg = config.ooknet.host.hardware.battery;
|
||||
inherit (lib) mkIf mkDefault mkOption types;
|
||||
inherit (lib) mkIf mkDefault;
|
||||
inherit (builtins) elem;
|
||||
MHz = x: x * 1000;
|
||||
in
|
||||
|
||||
{
|
||||
options.ooknet.host.hardware.battery = {
|
||||
powersave = {
|
||||
minFreq = mkOption {
|
||||
type = types.int;
|
||||
default = 800;
|
||||
description = "Minimum frequency for powersave mode in MHz";
|
||||
};
|
||||
maxFreq = mkOption {
|
||||
type = types.int;
|
||||
default = 1100;
|
||||
description = "Maximum frequency for powersave mode in MHz";
|
||||
};
|
||||
};
|
||||
performance = {
|
||||
minFreq = mkOption {
|
||||
type = types.int;
|
||||
default = 1500;
|
||||
description = "Minimum frequency for performance mode in MHz";
|
||||
};
|
||||
maxFreq = mkOption {
|
||||
type = types.int;
|
||||
default = 2600;
|
||||
description = "Maximum frequency for performance mode in MHz";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (elem "battery" features) {
|
||||
boot = {
|
||||
kernelModules = ["acpi_call"];
|
||||
|
|
|
|||
|
|
@ -1,9 +1,3 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) types mkOption;
|
||||
in
|
||||
|
||||
{
|
||||
imports = [
|
||||
./bluetooth.nix
|
||||
|
|
@ -13,10 +7,4 @@ in
|
|||
./audio.nix
|
||||
./video.nix
|
||||
];
|
||||
|
||||
options.ooknet.host.hardware.features = mkOption {
|
||||
type = with types; listOf (enum ["audio" "video" "bluetooth" "backlight" "battery" "ssd"]);
|
||||
default = [];
|
||||
description = "What extra hardware feature system modules to use";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,7 @@
|
|||
{ lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) types mkOption;
|
||||
in
|
||||
|
||||
{
|
||||
imports = [
|
||||
./amd.nix
|
||||
./intel.nix
|
||||
./nvidia.nix
|
||||
];
|
||||
|
||||
options.ooknet.host.hardware.gpu.type = mkOption {
|
||||
type = with types; nullOr (enum ["intel" "amd" "nvidia"]);
|
||||
default = null;
|
||||
description = "Type of gpu system module to use";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,62 +0,0 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
cfg = config.ooknet.host.hardware.monitors;
|
||||
in
|
||||
{
|
||||
options.ooknet.host.hardware.monitors = mkOption {
|
||||
type = types.listOf (types.submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
example = "DP-1";
|
||||
};
|
||||
primary = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
width = mkOption {
|
||||
type = types.int;
|
||||
example = 1920;
|
||||
};
|
||||
height = mkOption {
|
||||
type = types.int;
|
||||
example = 1080;
|
||||
};
|
||||
refreshRate = mkOption {
|
||||
type = types.int;
|
||||
default = 60;
|
||||
};
|
||||
x = mkOption {
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
y = mkOption {
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
transform = mkOption {
|
||||
type = types.int;
|
||||
default = 0;
|
||||
};
|
||||
enabled = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
workspace = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
});
|
||||
default = [ ];
|
||||
};
|
||||
config = {
|
||||
assertions = [{
|
||||
assertion = ((lib.length cfg) != 0) ->
|
||||
((lib.length (lib.filter (m: m.primary) cfg)) == 1);
|
||||
message = "Exactly one monitor must be set to primary.";
|
||||
}];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue