treewide: abstract away common configs into common/

This commit is contained in:
Yegor Timoshenko 2017-12-24 23:21:05 +00:00
parent b63e0eb372
commit 5407ba7a52
No known key found for this signature in database
GPG key ID: C34BF9DCC9DF8210
23 changed files with 112 additions and 38 deletions

View file

@ -1,6 +1,11 @@
{ lib, ... }: { lib, ... }:
{ {
imports = [
../../../common/cpu/intel
../../../common/pc/laptop
];
boot = { boot = {
initrd.kernelModules = [ "ata_piix" ]; initrd.kernelModules = [ "ata_piix" ];
kernelParams = [ kernelParams = [
@ -8,6 +13,7 @@
"acpi=on" "acpi=on"
"vga=0x317" "vga=0x317"
"video=vesafb:ywrap" "video=vesafb:ywrap"
# Important, to disable Kernel Mode Setting for the graphics card # Important, to disable Kernel Mode Setting for the graphics card
# This will allow backlight regulation # This will allow backlight regulation
"nomodeset" "nomodeset"
@ -17,13 +23,6 @@
hardware.opengl.driSupport = false; hardware.opengl.driSupport = false;
services.xserver = { services.xserver = {
enable = lib.mkDefault true;
defaultDepth = lib.mkDefault 24; defaultDepth = lib.mkDefault 24;
videoDrivers = [ "intel" ];
autorun = lib.mkDefault true;
synaptics = {
enable = lib.mkDefault true;
dev = "/dev/input/event8";
};
}; };
} }

View file

@ -1,6 +1,8 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
{ {
imports = [ ../../common/pc/laptop ];
boot = { boot = {
initrd.kernelModules = [ "pata_via" ]; initrd.kernelModules = [ "pata_via" ];
@ -15,8 +17,5 @@
hardware.firmware = with pkgs; [ intel2200BGFirmware ]; hardware.firmware = with pkgs; [ intel2200BGFirmware ];
services.xserver = { services.xserver.videoDrivers = [ "openchrome" ];
synaptics.enable = lib.mkDefault true;
videoDrivers = [ "unichrome" ];
};
} }

View file

@ -1,16 +1,19 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
{ {
imports = [ ../../. ]; imports = [
../.
../../../common/pc/laptop/ssd
];
# TODO: boot loader
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
# TODO: drop
hardware.opengl.driSupport32Bit = true; hardware.opengl.driSupport32Bit = true;
services.xserver = { services.xserver = {
libinput.enable = lib.mkDefault true;
# TODO: we should not enable unfree drivers # TODO: we should not enable unfree drivers
# when there is an alternative (i.e. nouveau) # when there is an alternative (i.e. nouveau)
videoDrivers = [ "nvidia" ]; videoDrivers = [ "nvidia" ];

View file

@ -2,7 +2,8 @@
{ {
imports = [ imports = [
../../. ../.
../../../common/pc/laptop/ssd
<nixpkgs/nixos/modules/hardware/network/broadcom-43xx.nix> <nixpkgs/nixos/modules/hardware/network/broadcom-43xx.nix>
]; ];

View file

@ -0,0 +1,7 @@
{
imports = [
../.
../../common/cpu/intel
../../common/pc/laptop
];
}

2
common/README.org Normal file
View file

@ -0,0 +1,2 @@
*NB!* This subtree is subject to change. Please don't import from here directly
for now, unless you're OK that things might break at any point in time.

View file

@ -0,0 +1,3 @@
{
hardware.cpu.amd.updateMicrocode = true;
}

View file

@ -0,0 +1,4 @@
{
hardware.cpu.intel.updateMicrocode = true;
services.xserver.videoDrivers = [ "intel" ];
}

5
common/pc/default.nix Normal file
View file

@ -0,0 +1,5 @@
{ lib, ... }:
{
services.xserver.libinput.enable = lib.mkDefault true;
}

View file

@ -0,0 +1,7 @@
{ lib, ... }:
{
boot.kernel.sysctl = {
"vm.swappiness" = lib.mkDefault 10;
};
}

View file

@ -0,0 +1,11 @@
{ lib, ... }:
{
imports = [ ../. ];
boot.kernel.sysctl = {
"vm.laptop_mode" = lib.mkDefault 5;
};
services.tlp.enable = lib.mkDefault true;
}

View file

@ -0,0 +1,8 @@
{ lib, ... }:
{
imports = [ ../../hdd ];
# Hard disk protection if the laptop falls:
services.hdapsd.enable = lib.mkDefault true;
}

1
common/pc/laptop/ssd Symbolic link
View file

@ -0,0 +1 @@
../ssd

View file

@ -0,0 +1,7 @@
{ lib, ... }:
{
boot.kernel.sysctl = {
"vm.swappiness" = lib.mkDefault 1;
};
}

View file

@ -1,11 +1,15 @@
{ lib, ... }: { lib, ... }:
{ {
imports = [
../../../common/cpu/intel
../../../common/pc/laptop
];
# TODO: boot loader
boot.loader.systemd-boot.enable = lib.mkDefault true; boot.loader.systemd-boot.enable = lib.mkDefault true;
boot.loader.efi.canTouchEfiVariables = lib.mkDefault true; boot.loader.efi.canTouchEfiVariables = lib.mkDefault true;
# To just use Intel integrated graphics with Intel's open source driver # To just use Intel integrated graphics with Intel's open source driver
# hardware.nvidiaOptimus.disable = true; # hardware.nvidiaOptimus.disable = true;
services.xserver.libinput.enable = lib.mkDefault true;
} }

View file

@ -0,0 +1,3 @@
{
imports = [ ../../common/pc/laptop ];
}

View file

@ -1,7 +1,10 @@
{ lib, ... }: { lib, ... }:
{ {
hardware.cpu.intel.updateMicrocode = lib.mkDefault true; imports = [
../.
../../../common/cpu/intel
];
# https://github.com/NixOS/nixpkgs/issues/18356 # https://github.com/NixOS/nixpkgs/issues/18356
boot.blacklistedKernelModules = [ "nouveau" ]; boot.blacklistedKernelModules = [ "nouveau" ];

View file

@ -1,9 +1,10 @@
{ lib, pkgs, ... }: { lib, pkgs, ... }:
{ {
imports = [ ../../common/pc/laptop ];
hardware.trackpoint.enable = lib.mkDefault true; hardware.trackpoint.enable = lib.mkDefault true;
services.tlp.enable = lib.mkDefault true; services.thinkfan.enable = lib.mkDefault true;
services.xserver.libinput.enable = lib.mkDefault true;
# Fingerprint reader: login and unlock with fingerprint (if you add one with `fprintd-enroll`) # Fingerprint reader: login and unlock with fingerprint (if you add one with `fprintd-enroll`)
# services.fprintd.enable = true; # services.fprintd.enable = true;

View file

@ -1,7 +1,11 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = [ ../. ../tp-smapi.nix ]; imports = [
../.
../tp-smapi.nix
../../../common/cpu/intel
];
boot = { boot = {
kernelParams = [ kernelParams = [
@ -27,8 +31,4 @@
"sierra_net" "cdc_mbim" "cdc_ncm" "btusb" "sierra_net" "cdc_mbim" "cdc_ncm" "btusb"
]; ];
}; };
hardware.cpu.intel.updateMicrocode = lib.mkDefault true;
services.xserver.videoDrivers = [ "intel" ];
} }

View file

@ -1,7 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = [ ../. ]; imports = [
../.
../../../common/cpu/intel
];
boot = { boot = {
extraModprobeConfig = lib.mkDefault '' extraModprobeConfig = lib.mkDefault ''
@ -9,6 +12,4 @@
''; '';
kernelModules = [ "tpm-rng" ]; kernelModules = [ "tpm-rng" ];
}; };
services.xserver.videoDrivers = [ "intel" ];
} }

View file

@ -1,11 +1,12 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = [ ../. ]; imports = [
../../../common/cpu/intel
../.
];
# Use the gummiboot efi boot loader. (From default generated configuration.nix) # TODO: boot loader
boot.loader.systemd-boot.enable = lib.mkDefault true; boot.loader.systemd-boot.enable = lib.mkDefault true;
boot.loader.efi.canTouchEfiVariables = lib.mkDefault true; boot.loader.efi.canTouchEfiVariables = lib.mkDefault true;
services.xserver.videoDrivers = [ "intel" ];
} }

View file

@ -1,7 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = [ ../. ]; imports = [
../.
../../../common/cpu/amd
];
boot.extraModprobeConfig = lib.mkDefault '' boot.extraModprobeConfig = lib.mkDefault ''
options snd_hda_intel enable=0,1 options snd_hda_intel enable=0,1

View file

@ -1,9 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = [ ../. ../tp-smapi.nix ]; imports = [
../.
# hard disk protection if the laptop falls ../../../common/cpu/intel
services.hdapsd.enable = lib.mkDefault true; ../../../common/pc/laptop/hdd
services.xserver.videoDrivers = [ "intel" ]; ../tp-smapi.nix
];
} }