From 9082dd0de498817f14aca4c4e640cea25bd84510 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Sun, 21 Nov 2021 00:24:57 -0500 Subject: [PATCH] hardware/form: add form module with common forms --- hosts/Infini-DESKTOP/default.nix | 2 +- hosts/Infini-FRAMEWORK/default.nix | 3 +-- hosts/Infini-SERVER/default.nix | 2 ++ hosts/Infini-STICK/default.nix | 2 ++ hosts/Infini-SWIFT/default.nix | 3 +-- modules/modules/hardware/form.nix | 43 ++++++++++++++++++++++++++++++ profiles/hardware/laptop.nix | 12 --------- 7 files changed, 50 insertions(+), 17 deletions(-) create mode 100644 modules/modules/hardware/form.nix delete mode 100644 profiles/hardware/laptop.nix diff --git a/hosts/Infini-DESKTOP/default.nix b/hosts/Infini-DESKTOP/default.nix index 6700065..0c73aae 100644 --- a/hosts/Infini-DESKTOP/default.nix +++ b/hosts/Infini-DESKTOP/default.nix @@ -30,7 +30,7 @@ modules = { hardware = { - audio.enable = true; + form.desktop = true; }; }; diff --git a/hosts/Infini-FRAMEWORK/default.nix b/hosts/Infini-FRAMEWORK/default.nix index 06df46c..202218d 100644 --- a/hosts/Infini-FRAMEWORK/default.nix +++ b/hosts/Infini-FRAMEWORK/default.nix @@ -8,7 +8,6 @@ networking.wireless (with hardware; [ - laptop gpu.intel wireless ]) @@ -47,7 +46,7 @@ modules = { hardware = { - audio.enable = true; + form.laptop = true; }; }; diff --git a/hosts/Infini-SERVER/default.nix b/hosts/Infini-SERVER/default.nix index 9c17557..751d52d 100644 --- a/hosts/Infini-SERVER/default.nix +++ b/hosts/Infini-SERVER/default.nix @@ -8,4 +8,6 @@ hardware.gpu.nvidia ]; }; + + modules.hardware.form.server = true; } diff --git a/hosts/Infini-STICK/default.nix b/hosts/Infini-STICK/default.nix index 3e0f3c8..45060d1 100644 --- a/hosts/Infini-STICK/default.nix +++ b/hosts/Infini-STICK/default.nix @@ -29,5 +29,7 @@ # networking.interfaces.wlp170s0.useDHCP = true; networking.interfaces.enp39s0.useDHCP = true; + modules.hardware.form.portable = true; + system.stateVersion = "21.11"; } diff --git a/hosts/Infini-SWIFT/default.nix b/hosts/Infini-SWIFT/default.nix index 0dd5c19..dc44456 100644 --- a/hosts/Infini-SWIFT/default.nix +++ b/hosts/Infini-SWIFT/default.nix @@ -10,7 +10,6 @@ (with hardware; [ gpu.amdgpu - laptop wireless ]) @@ -27,7 +26,7 @@ modules = { hardware = { - audio.enable = true; + form.laptop = true; }; }; diff --git a/modules/modules/hardware/form.nix b/modules/modules/hardware/form.nix new file mode 100644 index 0000000..22fc27f --- /dev/null +++ b/modules/modules/hardware/form.nix @@ -0,0 +1,43 @@ +{ config, lib, ... }: +with lib; +with lib.hlissner; +let + cfg = config.modules.hardware.form; +in +{ + options.modules.hardware.form = with types; { + desktop = mkBoolOpt false; + laptop = mkBoolOpt false; + portable = mkBoolOpt false; + raspi = mkBoolOpt false; + server = mkBoolOpt false; + }; + + config = mkMerge [ + (mkIf cfg.desktop { + modules.hardware.audio.enable = true; + }) + (mkIf cfg.laptop { + modules.hardware.audio.enable = true; + + services = { + xserver.libinput = { + enable = true; + touchpad.naturalScrolling = true; + }; + + logind.lidSwitch = "ignore"; + }; + + environment = { + variables.LAPTOP = "True"; + systemPackages = with pkgs; [ acpi ]; + }; + + + }) + (mkIf cfg.portable { }) + (mkIf cfg.raspi { }) + (mkIf cfg.server { }) + ]; +} diff --git a/profiles/hardware/laptop.nix b/profiles/hardware/laptop.nix deleted file mode 100644 index 5e061f8..0000000 --- a/profiles/hardware/laptop.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs, ... }: { - services.xserver.libinput = { - enable = true; - touchpad.naturalScrolling = true; - }; - - environment.variables.LAPTOP = "True"; - - services.logind.lidSwitch = "ignore"; - - environment.systemPackages = with pkgs; [ acpi ]; -}