diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-01-07 16:23:40 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-01-07 16:24:02 +0000 |
commit | 8c0790eb6095ef59a9623596f5794d250b95c699 (patch) | |
tree | 4801e46054b433e786e15d030b6cab991d8a6724 /modules/nixos-hardware/common | |
parent | 36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (diff) | |
parent | 99cdc883064ac5a1b9e189d3500a809616e79765 (diff) | |
download | nixlib-8c0790eb6095ef59a9623596f5794d250b95c699.tar nixlib-8c0790eb6095ef59a9623596f5794d250b95c699.tar.gz nixlib-8c0790eb6095ef59a9623596f5794d250b95c699.tar.bz2 nixlib-8c0790eb6095ef59a9623596f5794d250b95c699.tar.lz nixlib-8c0790eb6095ef59a9623596f5794d250b95c699.tar.xz nixlib-8c0790eb6095ef59a9623596f5794d250b95c699.tar.zst nixlib-8c0790eb6095ef59a9623596f5794d250b95c699.zip |
Add 'modules/nixos-hardware/' from commit '99cdc883064ac5a1b9e189d3500a809616e79765'
git-subtree-dir: modules/nixos-hardware git-subtree-mainline: 36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 git-subtree-split: 99cdc883064ac5a1b9e189d3500a809616e79765
Diffstat (limited to 'modules/nixos-hardware/common')
12 files changed, 126 insertions, 0 deletions
diff --git a/modules/nixos-hardware/common/cpu/amd/default.nix b/modules/nixos-hardware/common/cpu/amd/default.nix new file mode 100644 index 000000000000..d8c48a263081 --- /dev/null +++ b/modules/nixos-hardware/common/cpu/amd/default.nix @@ -0,0 +1,6 @@ +{ config, lib, ... }: + +{ + hardware.cpu.amd.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/nixos-hardware/common/cpu/intel/default.nix b/modules/nixos-hardware/common/cpu/intel/default.nix new file mode 100644 index 000000000000..7f2223c72e40 --- /dev/null +++ b/modules/nixos-hardware/common/cpu/intel/default.nix @@ -0,0 +1,14 @@ +{ config, lib, pkgs, ... }: + +{ + boot.initrd.kernelModules = [ "i915" ]; + + hardware.cpu.intel.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; + + hardware.opengl.extraPackages = with pkgs; [ + vaapiIntel + vaapiVdpau + libvdpau-va-gl + ]; +} diff --git a/modules/nixos-hardware/common/cpu/intel/kaby-lake/default.nix b/modules/nixos-hardware/common/cpu/intel/kaby-lake/default.nix new file mode 100644 index 000000000000..e6a2d1ce8e6e --- /dev/null +++ b/modules/nixos-hardware/common/cpu/intel/kaby-lake/default.nix @@ -0,0 +1,8 @@ +{ + imports = [ ../. ]; + + boot.kernelParams = [ + "i915.enable_fbc=1" + "i915.enable_psr=2" + ]; +} diff --git a/modules/nixos-hardware/common/cpu/intel/sandy-bridge/default.nix b/modules/nixos-hardware/common/cpu/intel/sandy-bridge/default.nix new file mode 100644 index 000000000000..682815cee473 --- /dev/null +++ b/modules/nixos-hardware/common/cpu/intel/sandy-bridge/default.nix @@ -0,0 +1,9 @@ +{ + imports = [ ../. ]; + + # Enables RC6, RC6p and RC6pp. + # Last two are only available on Sandy Bridge CPUs (circa 2011). + boot.kernelParams = [ + "i915.enable_rc6=7" + ]; +} diff --git a/modules/nixos-hardware/common/pc/default.nix b/modules/nixos-hardware/common/pc/default.nix new file mode 100644 index 000000000000..0b498ff1d20e --- /dev/null +++ b/modules/nixos-hardware/common/pc/default.nix @@ -0,0 +1,5 @@ +{ lib, ... }: + +{ + services.xserver.libinput.enable = lib.mkDefault true; +} diff --git a/modules/nixos-hardware/common/pc/hdd/default.nix b/modules/nixos-hardware/common/pc/hdd/default.nix new file mode 100644 index 000000000000..8cc5ada0deb9 --- /dev/null +++ b/modules/nixos-hardware/common/pc/hdd/default.nix @@ -0,0 +1,7 @@ +{ lib, ... }: + +{ + boot.kernel.sysctl = { + "vm.swappiness" = lib.mkDefault 10; + }; +} diff --git a/modules/nixos-hardware/common/pc/laptop/acpi_call.nix b/modules/nixos-hardware/common/pc/laptop/acpi_call.nix new file mode 100644 index 000000000000..f8c17dcc4901 --- /dev/null +++ b/modules/nixos-hardware/common/pc/laptop/acpi_call.nix @@ -0,0 +1,10 @@ +# acpi_call makes tlp work for newer thinkpads + +{ config, ... }: + +{ + boot = { + kernelModules = [ "acpi_call" ]; + extraModulePackages = with config.boot.kernelPackages; [ acpi_call ]; + }; +} diff --git a/modules/nixos-hardware/common/pc/laptop/cpu-throttling-bug.nix b/modules/nixos-hardware/common/pc/laptop/cpu-throttling-bug.nix new file mode 100644 index 000000000000..a44bb7225d0f --- /dev/null +++ b/modules/nixos-hardware/common/pc/laptop/cpu-throttling-bug.nix @@ -0,0 +1,38 @@ +{ config, pkgs, ... }: +{ + # Temporary fix for cpu throttling issues visible in the kernel log + # (journalctl -k) by setting the same temperature limits used by + # Window$ + # See https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues + systemd.services.cpu-throttling = { + enable = true; + description = "Sets the offset to 3 °C, so the new trip point is 97 °C"; + documentation = [ + "https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues" + ]; + path = [ pkgs.msr-tools ]; + script = "wrmsr -a 0x1a2 0x3000000"; + serviceConfig = { + Type = "oneshot"; + }; + wantedBy = [ + "timers.target" + ]; + }; + + systemd.timers.cpu-throttling = { + enable = true; + description = "Set cpu heating limit to 97 °C"; + documentation = [ + "https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues" + ]; + timerConfig = { + OnActiveSec = 60; + OnUnitActiveSec = 60; + Unit = "cpu-throttling.service"; + }; + wantedBy = [ + "timers.target" + ]; + }; +} diff --git a/modules/nixos-hardware/common/pc/laptop/default.nix b/modules/nixos-hardware/common/pc/laptop/default.nix new file mode 100644 index 000000000000..ebc4931dbc29 --- /dev/null +++ b/modules/nixos-hardware/common/pc/laptop/default.nix @@ -0,0 +1,13 @@ +{ config, lib, ... }: + +{ + imports = [ ../. ]; + + # TODO: fix in NixOS/nixpkgs + # Disable governor set in hardware-configuration.nix, + # required when services.tlp.enable is true: + powerManagement.cpuFreqGovernor = + lib.mkIf config.services.tlp.enable (lib.mkForce null); + + services.tlp.enable = lib.mkDefault true; +} diff --git a/modules/nixos-hardware/common/pc/laptop/hdd/default.nix b/modules/nixos-hardware/common/pc/laptop/hdd/default.nix new file mode 100644 index 000000000000..63f29d458c29 --- /dev/null +++ b/modules/nixos-hardware/common/pc/laptop/hdd/default.nix @@ -0,0 +1,8 @@ +{ lib, ... }: + +{ + imports = [ ../../hdd ]; + + # Hard disk protection if the laptop falls: + services.hdapsd.enable = lib.mkDefault true; +} diff --git a/modules/nixos-hardware/common/pc/laptop/ssd b/modules/nixos-hardware/common/pc/laptop/ssd new file mode 120000 index 000000000000..e313834a4372 --- /dev/null +++ b/modules/nixos-hardware/common/pc/laptop/ssd @@ -0,0 +1 @@ +../ssd \ No newline at end of file diff --git a/modules/nixos-hardware/common/pc/ssd/default.nix b/modules/nixos-hardware/common/pc/ssd/default.nix new file mode 100644 index 000000000000..af0b49568cd1 --- /dev/null +++ b/modules/nixos-hardware/common/pc/ssd/default.nix @@ -0,0 +1,7 @@ +{ lib, ... }: + +{ + boot.kernel.sysctl = { + "vm.swappiness" = lib.mkDefault 1; + }; +} |