office: simple-scan: install
[julm/julm-nix.git] / hosts / oignon / hardware.nix
index b7bda9f2375e042add06499ac70bdc8cf9904f22..1468f7ccaa20cf54c2747ff4e1427a2fd7f07c55 100644 (file)
@@ -1,76 +1,92 @@
-{ config, lib, pkgs, hostName, ... }:
+{ pkgs, hostName, ... }:
 {
-imports = [
-  ../../nixos/profiles/hardware/X201.nix
-  ../../nixos/profiles/zfs.nix
-  ../../nixos/profiles/zramSwap.nix
-];
+  imports = [
+    ../../nixos/profiles/hardware/X201.nix
+    ../../nixos/profiles/zfs.nix
+    ../../nixos/profiles/zramSwap.nix
+  ];
 
-# Setting the machine-id avoids to reencrypt all credentials
-# when reinstalling NixOS on a new drive.
-# Manually generated with : uuidgen | tr -d -
-environment.etc.machine-id.text = "46e396e54c264a3594d21de5c519dccf";
+  # Setting the machine-id avoids to reencrypt all credentials
+  # when reinstalling NixOS on a new drive.
+  # Manually generated with : uuidgen | tr -d -
+  environment.etc.machine-id.source = ./machine-id.clear;
 
-# The 32-bit host id of the host, formatted as 8 hexadecimal characters.
-# You should try to make this id unique among your hosts.
-# Manually generated with : uuidgen | head -c8
-networking.hostId = "ce53d0c3";
+  # The 32-bit host id of the host, formatted as 8 hexadecimal characters.
+  # You should try to make this id unique among your hosts.
+  # Manually generated with : uuidgen | head -c8
+  networking.hostId = "ce53d0c3";
 
-/*
-boot.loader.efi = {
-  canTouchEfiVariables = true;
-  efiSysMountPoint = "/boot/efi";
-};
-*/
-boot.loader.grub = {
-  enable  = true;
-  version = 2;
-  devices = [
-    "/dev/disk/by-id/ata-Samsung_SSD_850_PRO_128GB_S1SMNSAFC36436X"
-  ];
-  configurationLimit = 16;
+  /*
+    boot.loader.efi = {
+    canTouchEfiVariables = true;
+    efiSysMountPoint = "/boot/efi";
+    };
+  */
+  boot.loader.grub = {
+    enable = true;
+    memtest86.enable = true;
+    devices = [
+      "/dev/disk/by-id/ata-Samsung_SSD_850_PRO_128GB_S1SMNSAFC36436X"
+    ];
+    configurationLimit = 16;
+
+    #zfsSupport = true;
+    #efiSupport = true;
+    #enableCryptodisk = true;
+  };
+  boot.zfs.requestEncryptionCredentials = [ hostName ];
 
-  #zfsSupport = true;
-  #efiSupport = true;
-  #enableCryptodisk = true;
-};
+  hardware.enableRedistributableFirmware = true;
 
-# Note that gobi_loader -2000 has to be rerun if the SIM is hot swapped
-services.udev.extraRules = ''
-  ACTION=="add", SUBSYSTEM=="tty", KERNEL=="ttyUSB*", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9204", RUN+="${pkgs.gobi_loader}/lib/udev/gobi_loader -2000 $env{DEVNAME} /home/julm/documents/thinkpad-x201/gobi"
-'';
+  # Note that gobi_loader -2000 has to be rerun if the SIM is hot swapped
+  services.udev.extraRules = ''
+    ACTION=="add", SUBSYSTEM=="tty", KERNEL=="ttyUSB*", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="9204", RUN+="${pkgs.gobi_loader}/lib/udev/gobi_loader -2000 $env{DEVNAME} /home/julm/files/thinkpad-x201/gobi"
+  '';
 
-fileSystems."/boot" =
-  { device = "/dev/disk/by-partlabel/${hostName}_ssd_boot";
-    fsType = "ext2";
-  };
-fileSystems."/boot/efi" =
-  { device = "/dev/disk/by-partlabel/${hostName}_ssd_efi";
-    fsType = "vfat";
-  };
-swapDevices = [
-  { device = "/dev/disk/by-partlabel/${hostName}_ssd_swap";
-    randomEncryption = {
-      enable = true;
-      cipher = "aes-xts-plain64";
-      source = "/dev/urandom";
+  fileSystems."/boot" =
+    {
+      device = "/dev/disk/by-partlabel/${hostName}_ssd_boot";
+      fsType = "ext2";
+    };
+  fileSystems."/boot/efi" =
+    {
+      device = "/dev/disk/by-partlabel/${hostName}_ssd_efi";
+      fsType = "vfat";
     };
-  }
-];
+  swapDevices = [
+    {
+      device = "/dev/disk/by-partlabel/${hostName}_ssd_swap";
+      randomEncryption = {
+        enable = true;
+        cipher = "aes-xts-plain64";
+        source = "/dev/urandom";
+      };
+    }
+  ];
 
-boot.supportedFilesystems = [ "ntfs" "vfat" ];
+  boot.supportedFilesystems = [ "ntfs" "vfat" ];
 
-fileSystems."/" =
-  { device = "${hostName}/root";
-    fsType = "zfs";
-  };
-fileSystems."/nix" =
-  { device = "${hostName}/nix";
-    fsType = "zfs";
-  };
-fileSystems."/var" =
-  { device = "${hostName}/var";
-    fsType = "zfs";
+  fileSystems."/" =
+    {
+      device = "${hostName}/root";
+      fsType = "zfs";
+    };
+  fileSystems."/nix" =
+    {
+      device = "${hostName}/nix";
+      fsType = "zfs";
+    };
+  fileSystems."/var" =
+    {
+      device = "${hostName}/var";
+      fsType = "zfs";
+    };
+
+  services.pipewire.jack.enable = true;
+
+  services.acpid = {
+    # Suspending not work well on this old computer.
+    lidEventCommands = "";
   };
 
 }