Extract out more nix config files

This commit is contained in:
Cyryl Płotnicki 2019-07-18 22:17:36 +01:00
parent 61388c9850
commit 92a7016539
4 changed files with 70 additions and 63 deletions

View file

@ -1,4 +1,3 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
@ -17,6 +16,7 @@
"i915.enable_fbc=1" "i915.enable_fbc=1"
"i915.enable_psr=2" "i915.enable_psr=2"
"i915.enable_rc6=7" "i915.enable_rc6=7"
"mds=full"
]; ];
initrd.luks.devices = [ initrd.luks.devices = [
{ {
@ -36,43 +36,11 @@
time.timeZone = "Europe/London"; time.timeZone = "Europe/London";
hardware.trackpoint.enable = true; hardware.trackpoint.enable = true;
services.fprintd.enable = true; services.fprintd.enable = true;
systemd.services.cpu-throttling = {
enable = true;
description = "CPU Throttling Fix";
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 = "CPU Throttling Fix";
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"
];
};
imports = [ imports = [
/etc/nixos/hardware-configuration.nix /etc/nixos/hardware-configuration.nix
../quirks/thinkpad-cpu-throttling.nix
../boot.nix ../boot.nix
../common.nix ../common.nix
../gfx-intel.nix ../gfx-intel.nix

26
nixos/common-hardware.nix Normal file
View file

@ -0,0 +1,26 @@
{ config, pkgs, lib, ... }:
{
sound.enable = true;
networking.networkmanager.enable = true;
hardware.enableRedistributableFirmware = true;
hardware.cpu.intel.updateMicrocode = true;
hardware.pulseaudio = {
enable = true;
package = pkgs.pulseaudioFull;
extraModules = [ pkgs.pulseaudio-modules-bt ];
};
hardware.u2f.enable = true;
hardware.brightnessctl.enable = true;
hardware.sane.enable = true;
hardware.bluetooth = {
enable = true;
package = pkgs.bluezFull;
extraConfig = ''
[General]
Enable=Source,Sink,Media,Socket
'';
};
powerManagement.cpuFreqGovernor = (lib.mkForce null);
hardware.nvidiaOptimus.disable = true;
}

View file

@ -1,4 +1,4 @@
{ config, pkgs, lib , ... }: { config, pkgs, ... }:
let let
unstableTarball = fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz; unstableTarball = fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz;
@ -10,6 +10,7 @@ in
./vscode.nix ./vscode.nix
./syncthing.nix ./syncthing.nix
./gsconnect.nix ./gsconnect.nix
./common-hardware.nix
]; ];
nixpkgs.config = { nixpkgs.config = {
@ -51,10 +52,16 @@ in
tlp.enable = true; tlp.enable = true;
fstrim.enable = true; fstrim.enable = true;
physlock = {
enable = true;
allowAnyUser = true;
};
printing = { printing = {
enable = true; enable = true;
drivers = [ pkgs.epson-escpr pkgs.samsung-unified-linux-driver pkgs.splix ]; drivers = [ pkgs.epson-escpr pkgs.samsung-unified-linux-driver pkgs.splix ];
}; };
avahi = { avahi = {
enable = true; enable = true;
nssmdns = true; nssmdns = true;
@ -83,35 +90,8 @@ in
}; };
}; };
security.pam.services.gdm.enableGnomeKeyring = true;
fonts.fonts = [ pkgs.powerline-fonts ]; fonts.fonts = [ pkgs.powerline-fonts ];
sound.enable = true;
networking.networkmanager.enable = true;
hardware.enableRedistributableFirmware = true;
hardware.cpu.intel.updateMicrocode = true;
hardware.pulseaudio = {
enable = true;
package = pkgs.pulseaudioFull;
};
hardware.u2f.enable = true;
hardware.brightnessctl.enable = true;
hardware.sane.enable = true;
hardware.bluetooth = {
enable = true;
package = pkgs.bluezFull;
powerOnBoot = true;
};
powerManagement.cpuFreqGovernor = (lib.mkForce null);
hardware.nvidiaOptimus.disable = true;
services.physlock = {
enable = true;
allowAnyUser = true;
};
nix.gc.automatic = true; nix.gc.automatic = true;
nix.autoOptimiseStore = true; nix.autoOptimiseStore = true;
nix.optimise.automatic = true; nix.optimise.automatic = true;
@ -120,4 +100,3 @@ in
system.autoUpgrade.enable = true; system.autoUpgrade.enable = true;
system.stateVersion = "19.03"; system.stateVersion = "19.03";
} }

View file

@ -0,0 +1,34 @@
{ config, pkgs, ... }:
{
systemd.services.cpu-throttling = {
enable = true;
description = "CPU Throttling Fix";
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 = "CPU Throttling Fix";
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"
];
};
}