about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYegor Timoshenko <yegortimoshenko@gmail.com>2017-12-24 23:21:05 +0000
committerYegor Timoshenko <yegortimoshenko@gmail.com>2017-12-24 23:21:05 +0000
commit5407ba7a5242062edeaf3dbcd42d533b9ff96023 (patch)
tree796a83420dba49ebe0b5c81a52a436856fb3b03a
parentb63e0eb372b00d4cb5ca552ae9583bdb593f07dd (diff)
downloadnixlib-5407ba7a5242062edeaf3dbcd42d533b9ff96023.tar
nixlib-5407ba7a5242062edeaf3dbcd42d533b9ff96023.tar.gz
nixlib-5407ba7a5242062edeaf3dbcd42d533b9ff96023.tar.bz2
nixlib-5407ba7a5242062edeaf3dbcd42d533b9ff96023.tar.lz
nixlib-5407ba7a5242062edeaf3dbcd42d533b9ff96023.tar.xz
nixlib-5407ba7a5242062edeaf3dbcd42d533b9ff96023.tar.zst
nixlib-5407ba7a5242062edeaf3dbcd42d533b9ff96023.zip
treewide: abstract away common configs into common/
-rw-r--r--acer/aspire/4810t/default.nix13
-rw-r--r--airis/n990/default.nix7
-rw-r--r--apple/macbook-pro/10-1/default.nix9
-rw-r--r--apple/macbook-pro/12-1/default.nix3
-rw-r--r--apple/macbook-pro/default.nix7
-rw-r--r--common/README.org2
-rw-r--r--common/cpu/amd/default.nix3
-rw-r--r--common/cpu/intel/default.nix4
-rw-r--r--common/pc/default.nix5
-rw-r--r--common/pc/hdd/default.nix7
-rw-r--r--common/pc/laptop/default.nix11
-rw-r--r--common/pc/laptop/hdd/default.nix8
l---------common/pc/laptop/ssd1
-rw-r--r--common/pc/ssd/default.nix7
-rw-r--r--dell/xps/15-9550/default.nix8
-rw-r--r--lenovo/ideapad/default.nix3
-rw-r--r--lenovo/ideapad/z510/default.nix5
-rw-r--r--lenovo/thinkpad/default.nix5
-rw-r--r--lenovo/thinkpad/t410/default.nix10
-rw-r--r--lenovo/thinkpad/t440p/default.nix7
-rw-r--r--lenovo/thinkpad/t460s/default.nix9
-rw-r--r--lenovo/thinkpad/x140e/default.nix5
-rw-r--r--lenovo/thinkpad/x220/default.nix11
23 files changed, 112 insertions, 38 deletions
diff --git a/acer/aspire/4810t/default.nix b/acer/aspire/4810t/default.nix
index ed0e923a85c4..f21d630478de 100644
--- a/acer/aspire/4810t/default.nix
+++ b/acer/aspire/4810t/default.nix
@@ -1,6 +1,11 @@
 { lib, ... }:
 
 {
+  imports = [
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop
+  ];
+
   boot = {
     initrd.kernelModules = [ "ata_piix" ];
     kernelParams = [
@@ -8,6 +13,7 @@
       "acpi=on"
       "vga=0x317"
       "video=vesafb:ywrap"
+
       # Important, to disable Kernel Mode Setting for the graphics card
       # This will allow backlight regulation
       "nomodeset"
@@ -17,13 +23,6 @@
   hardware.opengl.driSupport = false;
 
   services.xserver = {
-    enable = lib.mkDefault true;
     defaultDepth = lib.mkDefault 24;
-    videoDrivers = [ "intel" ];
-    autorun = lib.mkDefault true;
-    synaptics = {
-      enable = lib.mkDefault true;
-      dev = "/dev/input/event8";
-    };
   };
 }
diff --git a/airis/n990/default.nix b/airis/n990/default.nix
index 7c45d2a2b3dc..ae06813131a8 100644
--- a/airis/n990/default.nix
+++ b/airis/n990/default.nix
@@ -1,6 +1,8 @@
 { lib, pkgs, ... }:
 
 {
+  imports = [ ../../common/pc/laptop ];
+
   boot = {
     initrd.kernelModules = [ "pata_via" ];
 
@@ -15,8 +17,5 @@
 
   hardware.firmware = with pkgs; [ intel2200BGFirmware ];
 
-  services.xserver = {
-    synaptics.enable = lib.mkDefault true;
-    videoDrivers = [ "unichrome" ];
-  };
+  services.xserver.videoDrivers = [ "openchrome" ];
 }
diff --git a/apple/macbook-pro/10-1/default.nix b/apple/macbook-pro/10-1/default.nix
index 0fa8a2f4bc2e..06e7486fb75f 100644
--- a/apple/macbook-pro/10-1/default.nix
+++ b/apple/macbook-pro/10-1/default.nix
@@ -1,16 +1,19 @@
 { lib, pkgs, ... }:
 
 {
-  imports = [ ../../. ];
+  imports = [
+    ../.
+    ../../../common/pc/laptop/ssd
+  ];
 
+  # TODO: boot loader
   boot.loader.systemd-boot.enable = true;
   boot.loader.efi.canTouchEfiVariables = true;
 
+  # TODO: drop
   hardware.opengl.driSupport32Bit = true;
 
   services.xserver = {
-    libinput.enable = lib.mkDefault true;
-
     # TODO: we should not enable unfree drivers
     # when there is an alternative (i.e. nouveau)
     videoDrivers = [ "nvidia" ];
diff --git a/apple/macbook-pro/12-1/default.nix b/apple/macbook-pro/12-1/default.nix
index 63c36db6472a..02c6f328cf5a 100644
--- a/apple/macbook-pro/12-1/default.nix
+++ b/apple/macbook-pro/12-1/default.nix
@@ -2,7 +2,8 @@
 
 {
   imports = [
-    ../../.
+    ../.
+    ../../../common/pc/laptop/ssd
     <nixpkgs/nixos/modules/hardware/network/broadcom-43xx.nix>
   ];
 
diff --git a/apple/macbook-pro/default.nix b/apple/macbook-pro/default.nix
new file mode 100644
index 000000000000..4ced65a382e0
--- /dev/null
+++ b/apple/macbook-pro/default.nix
@@ -0,0 +1,7 @@
+{
+  imports = [
+    ../.
+    ../../common/cpu/intel
+    ../../common/pc/laptop
+  ];
+}
diff --git a/common/README.org b/common/README.org
new file mode 100644
index 000000000000..3239e2f23b94
--- /dev/null
+++ b/common/README.org
@@ -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.
diff --git a/common/cpu/amd/default.nix b/common/cpu/amd/default.nix
new file mode 100644
index 000000000000..a8a36b2c91ba
--- /dev/null
+++ b/common/cpu/amd/default.nix
@@ -0,0 +1,3 @@
+{
+  hardware.cpu.amd.updateMicrocode = true;
+}
diff --git a/common/cpu/intel/default.nix b/common/cpu/intel/default.nix
new file mode 100644
index 000000000000..e3ce9193050e
--- /dev/null
+++ b/common/cpu/intel/default.nix
@@ -0,0 +1,4 @@
+{
+  hardware.cpu.intel.updateMicrocode = true;
+  services.xserver.videoDrivers = [ "intel" ];
+}
diff --git a/common/pc/default.nix b/common/pc/default.nix
new file mode 100644
index 000000000000..0b498ff1d20e
--- /dev/null
+++ b/common/pc/default.nix
@@ -0,0 +1,5 @@
+{ lib, ... }:
+
+{
+  services.xserver.libinput.enable = lib.mkDefault true;
+}
diff --git a/common/pc/hdd/default.nix b/common/pc/hdd/default.nix
new file mode 100644
index 000000000000..8cc5ada0deb9
--- /dev/null
+++ b/common/pc/hdd/default.nix
@@ -0,0 +1,7 @@
+{ lib, ... }:
+
+{
+  boot.kernel.sysctl = {
+    "vm.swappiness" = lib.mkDefault 10;
+  };
+}
diff --git a/common/pc/laptop/default.nix b/common/pc/laptop/default.nix
new file mode 100644
index 000000000000..305c160e2094
--- /dev/null
+++ b/common/pc/laptop/default.nix
@@ -0,0 +1,11 @@
+{ lib, ... }:
+
+{
+  imports = [ ../. ];
+
+  boot.kernel.sysctl = {
+    "vm.laptop_mode" = lib.mkDefault 5;
+  };
+
+  services.tlp.enable = lib.mkDefault true;
+}
diff --git a/common/pc/laptop/hdd/default.nix b/common/pc/laptop/hdd/default.nix
new file mode 100644
index 000000000000..63f29d458c29
--- /dev/null
+++ b/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/common/pc/laptop/ssd b/common/pc/laptop/ssd
new file mode 120000
index 000000000000..e313834a4372
--- /dev/null
+++ b/common/pc/laptop/ssd
@@ -0,0 +1 @@
+../ssd
\ No newline at end of file
diff --git a/common/pc/ssd/default.nix b/common/pc/ssd/default.nix
new file mode 100644
index 000000000000..af0b49568cd1
--- /dev/null
+++ b/common/pc/ssd/default.nix
@@ -0,0 +1,7 @@
+{ lib, ... }:
+
+{
+  boot.kernel.sysctl = {
+    "vm.swappiness" = lib.mkDefault 1;
+  };
+}
diff --git a/dell/xps/15-9550/default.nix b/dell/xps/15-9550/default.nix
index e0bb70058abd..90cfc6e2936a 100644
--- a/dell/xps/15-9550/default.nix
+++ b/dell/xps/15-9550/default.nix
@@ -1,11 +1,15 @@
 { lib, ... }:
 
 {
+  imports = [
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop
+  ];
+
+  # TODO: boot loader
   boot.loader.systemd-boot.enable = lib.mkDefault true;
   boot.loader.efi.canTouchEfiVariables = lib.mkDefault true;
 
   # To just use Intel integrated graphics with Intel's open source driver
   # hardware.nvidiaOptimus.disable = true;
-
-  services.xserver.libinput.enable = lib.mkDefault true;
 }
diff --git a/lenovo/ideapad/default.nix b/lenovo/ideapad/default.nix
new file mode 100644
index 000000000000..d774ba3793af
--- /dev/null
+++ b/lenovo/ideapad/default.nix
@@ -0,0 +1,3 @@
+{
+  imports = [ ../../common/pc/laptop ];
+}
diff --git a/lenovo/ideapad/z510/default.nix b/lenovo/ideapad/z510/default.nix
index 4c8edf38f215..83f656806854 100644
--- a/lenovo/ideapad/z510/default.nix
+++ b/lenovo/ideapad/z510/default.nix
@@ -1,7 +1,10 @@
 { lib, ... }:
 
 {
-  hardware.cpu.intel.updateMicrocode = lib.mkDefault true;
+  imports = [
+    ../.
+    ../../../common/cpu/intel
+  ];
 
   # https://github.com/NixOS/nixpkgs/issues/18356
   boot.blacklistedKernelModules = [ "nouveau" ];
diff --git a/lenovo/thinkpad/default.nix b/lenovo/thinkpad/default.nix
index ae9804b67181..52d09bcf9df0 100644
--- a/lenovo/thinkpad/default.nix
+++ b/lenovo/thinkpad/default.nix
@@ -1,9 +1,10 @@
 { lib, pkgs, ... }:
 
 {
+  imports = [ ../../common/pc/laptop ];
+
   hardware.trackpoint.enable = lib.mkDefault true;
-  services.tlp.enable = lib.mkDefault true;
-  services.xserver.libinput.enable = lib.mkDefault true;
+  services.thinkfan.enable = lib.mkDefault true;
 
   # Fingerprint reader: login and unlock with fingerprint (if you add one with `fprintd-enroll`)
   # services.fprintd.enable = true;
diff --git a/lenovo/thinkpad/t410/default.nix b/lenovo/thinkpad/t410/default.nix
index 568d9e65c573..737e91fe0c33 100644
--- a/lenovo/thinkpad/t410/default.nix
+++ b/lenovo/thinkpad/t410/default.nix
@@ -1,7 +1,11 @@
 { config, lib, pkgs, ... }:
 
 {
-  imports = [ ../. ../tp-smapi.nix ];
+  imports = [
+    ../.
+    ../tp-smapi.nix
+    ../../../common/cpu/intel
+  ];
 
   boot = {
     kernelParams = [
@@ -27,8 +31,4 @@
       "sierra_net" "cdc_mbim" "cdc_ncm" "btusb"
     ];
   };
-
-  hardware.cpu.intel.updateMicrocode = lib.mkDefault true;
-
-  services.xserver.videoDrivers = [ "intel" ];
 }
diff --git a/lenovo/thinkpad/t440p/default.nix b/lenovo/thinkpad/t440p/default.nix
index ddf6bd8ae9d3..464c874dc60b 100644
--- a/lenovo/thinkpad/t440p/default.nix
+++ b/lenovo/thinkpad/t440p/default.nix
@@ -1,7 +1,10 @@
 { config, lib, pkgs, ... }:
 
 {
-  imports = [ ../. ];
+  imports = [
+    ../.
+    ../../../common/cpu/intel
+  ];
 
   boot = {
     extraModprobeConfig = lib.mkDefault ''
@@ -9,6 +12,4 @@
     '';
     kernelModules = [ "tpm-rng" ];
   };
-
-  services.xserver.videoDrivers = [ "intel" ];
 }
diff --git a/lenovo/thinkpad/t460s/default.nix b/lenovo/thinkpad/t460s/default.nix
index ffe6ec33c00c..41558a35b7f6 100644
--- a/lenovo/thinkpad/t460s/default.nix
+++ b/lenovo/thinkpad/t460s/default.nix
@@ -1,11 +1,12 @@
 { 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.efi.canTouchEfiVariables = lib.mkDefault true;
-
-  services.xserver.videoDrivers = [ "intel" ];
 }
diff --git a/lenovo/thinkpad/x140e/default.nix b/lenovo/thinkpad/x140e/default.nix
index 81f67addcd85..c03410e936e2 100644
--- a/lenovo/thinkpad/x140e/default.nix
+++ b/lenovo/thinkpad/x140e/default.nix
@@ -1,7 +1,10 @@
 { config, lib, pkgs, ... }:
 
 {
-  imports = [ ../. ];
+  imports = [
+    ../.
+    ../../../common/cpu/amd
+  ];
 
   boot.extraModprobeConfig = lib.mkDefault ''
     options snd_hda_intel enable=0,1
diff --git a/lenovo/thinkpad/x220/default.nix b/lenovo/thinkpad/x220/default.nix
index efa67fc6a821..e821f966fa51 100644
--- a/lenovo/thinkpad/x220/default.nix
+++ b/lenovo/thinkpad/x220/default.nix
@@ -1,9 +1,10 @@
 { config, lib, pkgs, ... }:
 
 {
-  imports = [ ../. ../tp-smapi.nix ];
-
-  # hard disk protection if the laptop falls
-  services.hdapsd.enable = lib.mkDefault true;
-  services.xserver.videoDrivers = [ "intel" ];
+  imports = [
+    ../.
+    ../../../common/cpu/intel
+    ../../../common/pc/laptop/hdd
+    ../tp-smapi.nix
+  ];
 }