about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2023-05-02 17:50:50 -0700
committerFranck Cuny <franck@fcuny.net>2023-05-02 17:50:50 -0700
commit80b2a5ed2cf30c66ec75480c24c53c7b329c3381 (patch)
tree11c574af791e9a71ec39b03ffa682b58584bf796
parentprofiles/default: move default packages there (diff)
downloadworld-80b2a5ed2cf30c66ec75480c24c53c7b329c3381.tar.gz
profiles/hardware: create a few profiles related to hardware
-rw-r--r--hosts/aptos/default.nix1
-rw-r--r--hosts/aptos/hardware.nix3
-rw-r--r--hosts/aptos/networking.nix1
-rw-r--r--hosts/carmel/default.nix1
-rw-r--r--hosts/carmel/hardware.nix3
-rw-r--r--hosts/tahoe/default.nix1
-rw-r--r--hosts/tahoe/hardware.nix2
-rw-r--r--modules/default.nix2
-rw-r--r--modules/hardware/amd/default.nix14
-rw-r--r--modules/hardware/bluetooth/default.nix65
-rw-r--r--modules/hardware/default.nix5
-rw-r--r--modules/hardware/intel/default.nix14
-rw-r--r--modules/hardware/networking/default.nix12
-rw-r--r--modules/hardware/ssd/default.nix5
-rw-r--r--profiles/default.nix2
-rw-r--r--profiles/hardware/amd.nix6
-rw-r--r--profiles/hardware/intel.nix5
-rw-r--r--profiles/hardware/xps9300.nix12
18 files changed, 29 insertions, 125 deletions
diff --git a/hosts/aptos/default.nix b/hosts/aptos/default.nix
index 49d4c14..3ae3f86 100644
--- a/hosts/aptos/default.nix
+++ b/hosts/aptos/default.nix
@@ -7,6 +7,7 @@
     ./services.nix
     "${self}/profiles/workstation.nix"
     "${self}/profiles/laptop.nix"
+    "${self}/profiles/hardware/xps9300.nix"
   ];
 
   # install and configure sway
diff --git a/hosts/aptos/hardware.nix b/hosts/aptos/hardware.nix
index 4635e69..d6a2d32 100644
--- a/hosts/aptos/hardware.nix
+++ b/hosts/aptos/hardware.nix
@@ -41,9 +41,6 @@
   swapDevices =
     [{ device = "/dev/disk/by-uuid/24041034-ff39-44bf-a04c-8fd8318b554d"; }];
 
-  my.hardware.intel.enable = true;
-  my.hardware.bluetooth.enable = true;
-
   my.systems.btrfs.enable = true;
 
   powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
diff --git a/hosts/aptos/networking.nix b/hosts/aptos/networking.nix
index 111fbe7..b157ec5 100644
--- a/hosts/aptos/networking.nix
+++ b/hosts/aptos/networking.nix
@@ -33,6 +33,5 @@
     dnssec = "false";
   };
 
-  my.hardware.networking.wireless.enable = true;
   my.services.tailscale.enable = true;
 }
diff --git a/hosts/carmel/default.nix b/hosts/carmel/default.nix
index cbad04d..c9915d2 100644
--- a/hosts/carmel/default.nix
+++ b/hosts/carmel/default.nix
@@ -7,6 +7,7 @@
     ./networking.nix
     ./services.nix
     "${self}/profiles/server.nix"
+    "${self}/profiles/hardware/amd.nix"
   ];
 
   # This value determines the NixOS release from which the default
diff --git a/hosts/carmel/hardware.nix b/hosts/carmel/hardware.nix
index 94ece14..984f571 100644
--- a/hosts/carmel/hardware.nix
+++ b/hosts/carmel/hardware.nix
@@ -24,8 +24,5 @@
     };
 
   swapDevices = [ ];
-
-  my.hardware.amd.enable = true;
-
   powerManagement.cpuFreqGovernor = "schedutil";
 }
diff --git a/hosts/tahoe/default.nix b/hosts/tahoe/default.nix
index 4b0408b..e3d95a3 100644
--- a/hosts/tahoe/default.nix
+++ b/hosts/tahoe/default.nix
@@ -9,6 +9,7 @@ in
     ./networking.nix
     ./services.nix
     "${self}/profiles/server.nix"
+    "${self}/profiles/hardware/amd.nix"
   ];
 
   users.groups.nas.gid = 5000;
diff --git a/hosts/tahoe/hardware.nix b/hosts/tahoe/hardware.nix
index dbfffff..e81fca4 100644
--- a/hosts/tahoe/hardware.nix
+++ b/hosts/tahoe/hardware.nix
@@ -60,8 +60,6 @@
   swapDevices =
     [{ device = "/dev/disk/by-uuid/0f54b5ab-4fca-4c5a-a9eb-622553145163"; }];
 
-  my.hardware.amd.enable = true;
-
   my.systems.btrfs.enable = true;
 
   # high-resolution display
diff --git a/modules/default.nix b/modules/default.nix
index 96e66fb..d08b890 100644
--- a/modules/default.nix
+++ b/modules/default.nix
@@ -1,7 +1,7 @@
 { lib, ... }:
 
 {
-  imports = [ ./hardware ./system ./services ./programs ./secrets ];
+  imports = [ ./system ./services ./programs ./secrets ];
 
   options.my = with lib; {
     user = {
diff --git a/modules/hardware/amd/default.nix b/modules/hardware/amd/default.nix
deleted file mode 100644
index e8b80b0..0000000
--- a/modules/hardware/amd/default.nix
+++ /dev/null
@@ -1,14 +0,0 @@
-{ config, lib, ... }:
-let cfg = config.my.hardware.amd;
-in
-{
-  options.my.hardware.amd = with lib; {
-    enable = mkEnableOption "AMD related configuration";
-  };
-
-  config = lib.mkIf cfg.enable {
-    # Enable microcode update
-    hardware.cpu.amd.updateMicrocode = true;
-    boot.kernelModules = [ "kvm-amd" ];
-  };
-}
diff --git a/modules/hardware/bluetooth/default.nix b/modules/hardware/bluetooth/default.nix
deleted file mode 100644
index b48c51c..0000000
--- a/modules/hardware/bluetooth/default.nix
+++ /dev/null
@@ -1,65 +0,0 @@
-{ config, lib, pkgs, ... }:
-let cfg = config.my.hardware.bluetooth;
-in
-{
-  options.my.hardware.bluetooth = with lib; {
-    enable = mkEnableOption "bluetooth configuration";
-  };
-
-  config = lib.mkIf cfg.enable {
-    hardware.bluetooth.enable = true;
-    services.blueman.enable = true;
-
-    hardware.pulseaudio = {
-      extraModules = [ pkgs.pulseaudio-modules-bt ];
-      package = pkgs.pulseaudioFull;
-    };
-
-    environment.etc = {
-      "wireplumber/bluetooth.lua.d/50-bluez-config.lua".text = ''
-        bluez_monitor.properties = {
-          ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]",
-          -- mSBC provides better audio + microphone
-          ["bluez5.enable-msbc"] = true,
-          -- SBC XQ provides better audio
-          ["bluez5.enable-sbc-xq"] = true,
-          -- Hardware volume control
-          ["bluez5.enable-hw-volume"] = true,
-        }
-      '';
-    };
-
-    services.pipewire = {
-      media-session.config.bluez-monitor.rules = [
-        {
-          # Matches all cards
-          matches = [{ "device.name" = "~bluez_card.*"; }];
-          actions = {
-            "update-props" = {
-              "bluez5.reconnect-profiles" = [ "hfp_hf" "hsp_hs" "a2dp_sink" ];
-              # mSBC provides better audio + microphone
-              "bluez5.msbc-support" = true;
-              # SBC XQ provides better audio
-              "bluez5.sbc-xq-support" = true;
-            };
-          };
-        }
-        {
-          matches = [
-            # Matches all sources
-            {
-              "node.name" = "~bluez_input.*";
-            }
-            # Matches all outputs
-            { "node.name" = "~bluez_output.*"; }
-          ];
-          actions = { "node.pause-on-idle" = false; };
-        }
-      ];
-    };
-
-    hardware.bluetooth.settings = {
-      General = { Enable = "Source,Sink,Media,Socket"; };
-    };
-  };
-}
diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix
deleted file mode 100644
index 6d1441f..0000000
--- a/modules/hardware/default.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{ ... }:
-
-{
-  imports = [ ./amd ./bluetooth ./intel ./ssd ./networking ];
-}
diff --git a/modules/hardware/intel/default.nix b/modules/hardware/intel/default.nix
deleted file mode 100644
index 26d9877..0000000
--- a/modules/hardware/intel/default.nix
+++ /dev/null
@@ -1,14 +0,0 @@
-{ config, lib, ... }:
-let cfg = config.my.hardware.intel;
-in
-{
-  options.my.hardware.intel = with lib; {
-    enable = mkEnableOption "intel related configuration";
-  };
-
-  config = lib.mkIf cfg.enable {
-    # Enable microcode update
-    hardware.cpu.intel.updateMicrocode = true;
-    boot.kernelModules = [ "kvm-intel" ];
-  };
-}
diff --git a/modules/hardware/networking/default.nix b/modules/hardware/networking/default.nix
deleted file mode 100644
index fac6c30..0000000
--- a/modules/hardware/networking/default.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-{ config, lib, ... }:
-let cfg = config.my.hardware.networking;
-in
-{
-  options.my.hardware.networking = with lib; {
-    wireless = { enable = mkEnableOption "wireless configuration"; };
-  };
-
-  config = lib.mkMerge [
-    (lib.mkIf cfg.wireless.enable { networking.wireless.iwd.enable = true; })
-  ];
-}
diff --git a/modules/hardware/ssd/default.nix b/modules/hardware/ssd/default.nix
deleted file mode 100644
index 935c217..0000000
--- a/modules/hardware/ssd/default.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{ ... }:
-
-{
-  services.fstrim.enable = true;
-}
diff --git a/profiles/default.nix b/profiles/default.nix
index 7a2e6af..31e044a 100644
--- a/profiles/default.nix
+++ b/profiles/default.nix
@@ -8,6 +8,8 @@
   security.sudo.wheelNeedsPassword = false;
   security.polkit.enable = true;
 
+  services.fstrim.enable = true;
+
   programs.ssh = {
     # $ ssh-keyscan example.com
     knownHosts = {
diff --git a/profiles/hardware/amd.nix b/profiles/hardware/amd.nix
new file mode 100644
index 0000000..dc933ee
--- /dev/null
+++ b/profiles/hardware/amd.nix
@@ -0,0 +1,6 @@
+{ ... }:
+{
+  hardware.cpu.amd.updateMicrocode = true;
+  boot.kernelModules = [ "kvm-amd" "k10temp" ];
+  boot.kernelParams = [ "amd_pstate=passive" ];
+}
diff --git a/profiles/hardware/intel.nix b/profiles/hardware/intel.nix
new file mode 100644
index 0000000..756ad9a
--- /dev/null
+++ b/profiles/hardware/intel.nix
@@ -0,0 +1,5 @@
+{ ... }:
+{
+  hardware.cpu.intel.updateMicrocode = true;
+  boot.kernelModules = [ "kvm-intel" ];
+}
diff --git a/profiles/hardware/xps9300.nix b/profiles/hardware/xps9300.nix
new file mode 100644
index 0000000..3e58c88
--- /dev/null
+++ b/profiles/hardware/xps9300.nix
@@ -0,0 +1,12 @@
+{ ... }:
+{
+  imports = [
+    ./intel.nix
+  ];
+
+  boot.kernelParams = [ "mem_sleep_default=deep" ];
+
+  networking.wireless.iwd.enable = true;
+  hardware.bluetooth.enable = true;
+  services.blueman.enable = true;
+}