From fc019d789523ce5f89436b8dbc458cf3b79abf43 Mon Sep 17 00:00:00 2001 From: aristote Date: Tue, 29 Jul 2025 15:25:11 +0200 Subject: reformat everything with nixfmt --- modules/nixos/personal/hardware.nix | 44 +++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to 'modules/nixos/personal/hardware.nix') diff --git a/modules/nixos/personal/hardware.nix b/modules/nixos/personal/hardware.nix index 6f1183d..dfab964 100644 --- a/modules/nixos/personal/hardware.nix +++ b/modules/nixos/personal/hardware.nix @@ -3,9 +3,11 @@ lib, pkgs, ... -}: let +}: +let cfg = config.personal.hardware; -in { +in +{ options.personal.hardware = { usb.enable = lib.mkEnableOption "usb"; disks.crypted = lib.mkOption { @@ -20,24 +22,26 @@ in { default = "fr"; }; }; - backlights = let - mkBacklightOption = name: - lib.mkOption { - type = with lib.types; nullOr str; - default = null; - description = "Whether to allow all users to change hardware the ${name} brightness."; - }; - in { - screen = mkBacklightOption "screen"; - keyboard = mkBacklightOption "keyboard"; - }; + backlights = + let + mkBacklightOption = + name: + lib.mkOption { + type = with lib.types; nullOr str; + default = null; + description = "Whether to allow all users to change hardware the ${name} brightness."; + }; + in + { + screen = mkBacklightOption "screen"; + keyboard = mkBacklightOption "keyboard"; + }; sound.enable = lib.mkEnableOption "sound"; }; config = lib.mkMerge [ { - hardware.firmware = - lib.optional cfg.firmwareNonFree.enable pkgs.firmwareLinuxNonfree; + hardware.firmware = lib.optional cfg.firmwareNonFree.enable pkgs.firmwareLinuxNonfree; boot.initrd.availableKernelModules = lib.optional cfg.usb.enable "usb_storage"; services.udev.extraRules = @@ -49,15 +53,17 @@ in { ''; } - (let - crypt = cfg.disks.crypted; - in + ( + let + crypt = cfg.disks.crypted; + in lib.mkIf (crypt != null) { boot.initrd.luks.devices.crypt = { device = crypt; preLVM = true; }; - }) + } + ) (lib.mkIf cfg.sound.enable { security.rtkit.enable = true; -- cgit v1.2.3