about summary refs log tree commit diff
path: root/users
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2022-07-05T16·43-0700
committerwpcarro <wpcarro@gmail.com>2022-07-22T03·02+0000
commit33f6419d7efb777884c7c44dc2f00216fbd4191f (patch)
treec34532b34db9d1500a1d78b2d61621688e955498 /users
parentcd5fa69897fb0ab3abaf8b24e1a0eb482f933efc (diff)
refactor(wpcarro/nixos): Define shared nopn.nix module r/4313
Shared between `ava` and `tarasco`. Also define `lib/default.nix` to share
utility functions like `usermod` between NixOS configurations.

Change-Id: I65b8d37520426e164c9d5f722bee4731a3c6e641
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5942
Tested-by: BuildkiteCI
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Diffstat (limited to 'users')
-rw-r--r--users/wpcarro/lib/default.nix5
-rw-r--r--users/wpcarro/nixos/ava/default.nix5
-rw-r--r--users/wpcarro/nixos/ava/hardware.nix31
-rw-r--r--users/wpcarro/nixos/marcus/default.nix3
-rw-r--r--users/wpcarro/nixos/modules/hardware/nopn.nix52
-rw-r--r--users/wpcarro/nixos/tarasco/default.nix24
-rw-r--r--users/wpcarro/nixos/tarasco/hardware.nix24
7 files changed, 66 insertions, 78 deletions
diff --git a/users/wpcarro/lib/default.nix b/users/wpcarro/lib/default.nix
new file mode 100644
index 000000000000..6354877dd468
--- /dev/null
+++ b/users/wpcarro/lib/default.nix
@@ -0,0 +1,5 @@
+{ depot, ... }:
+
+{
+  usermod = name: depot.path.origSrc + ("/users/wpcarro/nixos/modules/${name}");
+}
diff --git a/users/wpcarro/nixos/ava/default.nix b/users/wpcarro/nixos/ava/default.nix
index 47a93ed2ef7c..ace2c81cfdbe 100644
--- a/users/wpcarro/nixos/ava/default.nix
+++ b/users/wpcarro/nixos/ava/default.nix
@@ -3,6 +3,7 @@
 
 let
   inherit (depot.users) wpcarro;
+  inherit (depot.users.wpcarro.lib) usermod;
 
   wpcarrosEmacs = wpcarro.emacs.nixos {
     load = [ ./ava.el ];
@@ -15,7 +16,9 @@ let
   };
 in
 {
-  imports = [ ./hardware.nix ];
+  imports = [
+    (usermod "hardware/nopn.nix")
+  ];
 
   # Use the TVL binary cache
   tvl.cache.enable = true;
diff --git a/users/wpcarro/nixos/ava/hardware.nix b/users/wpcarro/nixos/ava/hardware.nix
deleted file mode 100644
index 4bfdca1cc55a..000000000000
--- a/users/wpcarro/nixos/ava/hardware.nix
+++ /dev/null
@@ -1,31 +0,0 @@
-{ config, lib, pkgs, modulesPath, ... }:
-
-{
-  imports =
-    [
-      (modulesPath + "/installer/scan/not-detected.nix")
-    ];
-
-  boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
-  boot.initrd.kernelModules = [ ];
-  boot.kernelModules = [ "kvm-intel" ];
-  boot.extraModulePackages = [ ];
-
-  fileSystems."/" =
-    {
-      device = "/dev/disk/by-label/NIXROOT";
-      fsType = "ext4";
-    };
-
-  fileSystems."/boot" =
-    {
-      device = "/dev/disk/by-label/NIXBOOT";
-      fsType = "vfat";
-    };
-
-  swapDevices = [ ];
-
-  hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
-  # high-resolution display
-  hardware.video.hidpi.enable = lib.mkDefault true;
-}
diff --git a/users/wpcarro/nixos/marcus/default.nix b/users/wpcarro/nixos/marcus/default.nix
index db3472926a22..dfaea4bddbea 100644
--- a/users/wpcarro/nixos/marcus/default.nix
+++ b/users/wpcarro/nixos/marcus/default.nix
@@ -3,8 +3,7 @@
 
 let
   inherit (depot.users) wpcarro;
-
-  usermod = name: depot.path.origSrc + ("/users/wpcarro/nixos/modules/${name}");
+  inherit (depot.users.wpcarro.lib) usermod;
 
   wpcarrosEmacs = wpcarro.emacs.nixos {
     load = [ ./marcus.el ];
diff --git a/users/wpcarro/nixos/modules/hardware/nopn.nix b/users/wpcarro/nixos/modules/hardware/nopn.nix
new file mode 100644
index 000000000000..7733f5331ba6
--- /dev/null
+++ b/users/wpcarro/nixos/modules/hardware/nopn.nix
@@ -0,0 +1,52 @@
+# I tried looking up the manufacturer, product name, and version, but
+# `dmidecode -t system` reported "To be filled by O.E.M." for each of these
+# fields.
+{ config, lib, pkgs, modulesPath, ... }:
+
+{
+  imports = [
+    (modulesPath + "/installer/scan/not-detected.nix")
+  ];
+
+  fileSystems."/" = {
+    device = "/dev/disk/by-label/NIXROOT";
+    fsType = "ext4";
+  };
+
+  fileSystems."/boot" = {
+    device = "/dev/disk/by-label/NIXBOOT";
+    fsType = "vfat";
+  };
+
+  boot = {
+    initrd.availableKernelModules = [
+      "xhci_pci"
+      "ehci_pci"
+      "ahci"
+      "usb_storage"
+      "usbhid"
+      "sd_mod"
+    ];
+    initrd.kernelModules = [ ];
+    kernelModules = [ "kvm-intel" ];
+    extraModulePackages = [ ];
+
+    # Can verify these settings with:
+    # $ lsmod
+    # ...or:
+    # $ cat /etc/modprobe.d/nixos.conf
+    blacklistedKernelModules = [
+      # Disabling this buggy network driver (and preferring ethernet) to prevent
+      # my machine from becoming unresponsive.
+      # TODO(wpcarro): Consider replacing this module with this fork (if NixOS
+      # isn't already): https://github.com/tomaspinho/rtl8821ce
+      "rtw88_8821ce"
+    ];
+  };
+
+  swapDevices = [ ];
+
+  hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+  # high-resolution display
+  hardware.video.hidpi.enable = lib.mkDefault true;
+}
diff --git a/users/wpcarro/nixos/tarasco/default.nix b/users/wpcarro/nixos/tarasco/default.nix
index 17dd4bc856cd..bd7f2515f133 100644
--- a/users/wpcarro/nixos/tarasco/default.nix
+++ b/users/wpcarro/nixos/tarasco/default.nix
@@ -3,6 +3,7 @@
 
 let
   inherit (depot.users) wpcarro;
+  inherit (depot.users.wpcarro.lib) usermod;
 
   wpcarrosEmacs = wpcarro.emacs.nixos {
     load = [ ./tarasco.el ];
@@ -15,7 +16,9 @@ let
   };
 in
 {
-  imports = [ ./hardware.nix ];
+  imports = [
+    (usermod "hardware/nopn.nix")
+  ];
 
   # Use the TVL binary cache
   tvl.cache.enable = true;
@@ -27,25 +30,6 @@ in
     # Support IP forwarding to use this device as a Tailscale exit node.
     kernel.sysctl."net.ipv4.ip_forward" = true;
     kernel.sysctl."net.ipv6.conf.all.forwarding" = true;
-    kernelModules = [
-      "kvm-intel"
-    ];
-
-    # Can verify these settings with:
-    # $ lsmod
-    # ...or:
-    # $ cat /etc/modprobe.d/nixos.conf
-    blacklistedKernelModules = [
-      # Disabling this buggy network driver (and preferring ethernet) to prevent
-      # my machine from becoming unresponsive.
-      # TODO(wpcarro): Consider replacing this module with this fork (if NixOS
-      # isn't already): https://github.com/tomaspinho/rtl8821ce
-      "rtw88_8821ce"
-    ];
-
-    initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
-    initrd.kernelModules = [ ];
-    extraModulePackages = [ ];
   };
 
 
diff --git a/users/wpcarro/nixos/tarasco/hardware.nix b/users/wpcarro/nixos/tarasco/hardware.nix
deleted file mode 100644
index 3d09b9edd8d7..000000000000
--- a/users/wpcarro/nixos/tarasco/hardware.nix
+++ /dev/null
@@ -1,24 +0,0 @@
-{ config, lib, pkgs, modulesPath, ... }:
-
-{
-  imports =
-    [
-      (modulesPath + "/installer/scan/not-detected.nix")
-    ];
-
-  fileSystems."/" = {
-    device = "/dev/disk/by-label/NIXROOT";
-    fsType = "ext4";
-  };
-
-  fileSystems."/boot" = {
-    device = "/dev/disk/by-label/NIXBOOT";
-    fsType = "vfat";
-  };
-
-  swapDevices = [ ];
-
-  hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
-  # high-resolution display
-  hardware.video.hidpi.enable = lib.mkDefault true;
-}