home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

commit fe05b854c13f60501937f58e1f57ab5d2db6bfc9
parent 2b5d483381c739a2d2eb1360d958bb462303596d
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Fri, 19 Aug 2022 10:40:33 +0000

systems: update some hardware configuration

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Msystems/hardware/thinkpad-x1g9.nix | 27+++++++++++++--------------
Msystems/hardware/thinkpad.nix | 4----
Msystems/modules/hardware/laptop.nix | 57++++++++++++++++++++++++++++++++-------------------------
Msystems/modules/hardware/server.nix | 1+
4 files changed, 46 insertions(+), 43 deletions(-)

diff --git a/systems/hardware/thinkpad-x1g9.nix b/systems/hardware/thinkpad-x1g9.nix @@ -1,28 +1,27 @@ { config, pkgs, ... }: { - # imports = [ - # ./thinkpad.nix - # ]; + # NixOS options boot = { blacklistedKernelModules = [ "sierra_net" # sierra wireless modules - "cdc_mbim" # modem mobile broadband modules - "cdc_ncm" # similar + "cdc_mbim" # modem mobile broadband modules + "cdc_ncm" # similar ]; extraModprobeConfig = '' options snd_hda_intel power_save=1 ''; initrd = { availableKernelModules = [ - "nvme" # required for nvme disks - "thunderbolt" # required for thunderbolt (dock, ...) - "dm-mod" "cryptd" # required for encryption - "ahci" # sata controller, might not be needed - "xhci_pci" # usb controller related - "usb_storage" # usb storage related - "sd_mod" # block device related - "sdhci_pci" # block device related as well - "aesni-intel" # advanced encryption for intel + "nvme" # required for nvme disks + "thunderbolt" # required for thunderbolt (dock, ...) + "dm-mod" + "cryptd" # required for encryption + "ahci" # sata controller, might not be needed + "xhci_pci" # usb controller related + "usb_storage" # usb storage related + "sd_mod" # block device related + "sdhci_pci" # block device related as well + "aesni-intel" # advanced encryption for intel ]; }; loader.efi.canTouchEfiVariables = true; diff --git a/systems/hardware/thinkpad.nix b/systems/hardware/thinkpad.nix @@ -1,9 +1,5 @@ { config, pkgs, ... }: -#let -# sources = import ../../nix/sources.nix; -#in { - #imports = [ (sources.nixos-hardware + "/lenovo/thinkpad") ]; boot = { blacklistedKernelModules = [ # Kernel GPU Savings Options (NOTE i915 chipset only) diff --git a/systems/modules/hardware/laptop.nix b/systems/modules/hardware/laptop.nix @@ -1,6 +1,6 @@ { config, lib, pkgs, ... }: let - inherit (lib) mkEnableOption mkIf mkOption types; + inherit (lib) mkEnableOption mkIf mkMerge mkOption types; cfg = config.modules.hardware.laptop; in { @@ -9,28 +9,35 @@ in enable = mkEnableOption "Enable laptop profile"; }; }; - config = mkIf cfg.enable { - # Some systctl options for all laptops - boot.kernel.sysctl = { - "vm.swappiness" = 10; - "vm.dirty_ratio" = 25; - "vm.dirty_background_ratio" = 10; - "vm.dirty_writeback_centisecs" = 5000; - "vm.dirty_expire_centisecs" = 5000; - }; - # Packages that are always useful for laptops - environment.systemPackages = with pkgs; [ - lm_sensors - powertop - acpi - ]; - # Run nix-gc only when on AC power - systemd.services.nix-gc.unitConfig.ConditionACPower = true; - # When a laptop is docked, ignor the lid state (if the laptop is opened or closed) - services = { - logind.extraConfig = '' - HandleLidSwitchDocked=ignore - ''; - }; - }; + config = mkIf cfg.enable (mkMerge [ + { + # Some systctl options for all laptops + boot.kernel.sysctl = { + "vm.swappiness" = 10; + "vm.dirty_ratio" = 25; + "vm.dirty_background_ratio" = 10; + "vm.dirty_writeback_centisecs" = 5000; + "vm.dirty_expire_centisecs" = 5000; + }; + # Packages that are always useful for laptops + environment.systemPackages = with pkgs; [ + lm_sensors + powertop + acpi + ]; + # Run nix-gc only when on AC power + systemd.services.nix-gc.unitConfig.ConditionACPower = true; + # When a laptop is docked, ignor the lid state (if the laptop is opened or closed) + services = { + logind.extraConfig = '' + HandleLidSwitchDocked=ignore + ''; + }; + } + (mkIf config.modules.desktop.enable { + # Graphical interface, we can add additionnal packages + # Enable setting power-profiles trough DBus + services.power-profiles-daemon.enable = true; + }) + ]); } diff --git a/systems/modules/hardware/server.nix b/systems/modules/hardware/server.nix @@ -9,4 +9,5 @@ in enable = mkEnableOption "Enable server profile"; }; }; + config = mkIf cfg.enable { }; }