about summary refs log tree commit diff
path: root/hardware/pc
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2024-12-30 11:35:14 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2024-12-30 11:35:14 +0100
commitdce2c3c26a2ff9770bbba2a00471c03ab321c472 (patch)
tree91ce56182bab4dee87fd663ea70880446a15f7e7 /hardware/pc
parentFont: Change font style pt 1000 (diff)
downloadnixos-config-dce2c3c26a2ff9770bbba2a00471c03ab321c472.tar.gz
nixos-config-dce2c3c26a2ff9770bbba2a00471c03ab321c472.tar.bz2
nixos-config-dce2c3c26a2ff9770bbba2a00471c03ab321c472.zip
fmt
Diffstat (limited to 'hardware/pc')
-rw-r--r--hardware/pc/default.nix5
-rw-r--r--hardware/pc/disks.nix77
-rw-r--r--hardware/pc/hardware.nix26
3 files changed, 60 insertions, 48 deletions
diff --git a/hardware/pc/default.nix b/hardware/pc/default.nix
index 15d6b76..9b90a53 100644
--- a/hardware/pc/default.nix
+++ b/hardware/pc/default.nix
@@ -1,6 +1,5 @@
-{ ... }:
-{
-  imports = [ ./hardware.nix ];
+{...}: {
+  imports = [./hardware.nix];
 
   boot.loader.timeout = 5;
 }
diff --git a/hardware/pc/disks.nix b/hardware/pc/disks.nix
index 9672344..ded0350 100644
--- a/hardware/pc/disks.nix
+++ b/hardware/pc/disks.nix
@@ -1,5 +1,12 @@
-{ config, lib, inputs, pkgs, modulesPath, isIso, ... }:
-let
+{
+  config,
+  lib,
+  inputs,
+  pkgs,
+  modulesPath,
+  isIso,
+  ...
+}: let
   HDD = "/dev/disk/by-id/nvme-WD_BLACK_SN770_1TB_2251AD458811";
 
   partitionsCreateScript = ''
@@ -50,16 +57,14 @@ let
 
   # Utility to compare the root tree
   diff-root = pkgs.writers.writeDashBin "diff-root" ''
-    export PATH=${with pkgs; lib.makeBinPath [ diffutils less ]}:$PATH
+    export PATH=${with pkgs; lib.makeBinPath [diffutils less]}:$PATH
     current="$(mktemp current-root.XXX --tmpdir)"
     trap 'rm "$current"' EXIT INT HUP
     ${save-root}/bin/save-root "$current"
     diff -u /run/initial-root "$current" --color=always | ''${PAGER:-less -R}
   '';
-in
-{
+in {
   config = {
-
     environment.persistence."/persist" = {
       directories = [
         "/var/log"
@@ -79,7 +84,7 @@ in
     fileSystems."/" = {
       device = "none";
       fsType = "tmpfs";
-      options = [ "defaults" "mode=755" ];
+      options = ["defaults" "mode=755"];
     };
 
     fileSystems."/boot" = {
@@ -98,29 +103,28 @@ in
       device = "/dev/mapper/encrypted_root_pool-nix";
       fsType = "btrfs";
       neededForBoot = true;
-      options = [ "compress-force=zstd" "noatime" ];
+      options = ["compress-force=zstd" "noatime"];
     };
 
     fileSystems."/persist" = {
       device = "/dev/mapper/encrypted_root_pool-persist";
       fsType = "btrfs";
       neededForBoot = true;
-      options = [ "compress-force=zstd" "noatime" ];
+      options = ["compress-force=zstd" "noatime"];
     };
 
     fileSystems."/home" = {
       device = "/dev/mapper/encrypted_root_pool-home";
       fsType = "btrfs";
-      options = [ "compress-force=zstd" ];
+      options = ["compress-force=zstd"];
     };
 
-    swapDevices = [ ];
+    swapDevices = [];
 
     services.btrfs.autoScrub.enable = true;
 
     zramSwap.enable = true;
 
-
     environment.systemPackages = [
       config.disks-create
       config.disks-format
@@ -131,37 +135,42 @@ in
 
     systemd.services.save-root-snapshot = {
       description = "save a snapshot of the initial root tree";
-      wantedBy = [ "sysinit.target" ];
-      requires = [ "-.mount" ];
-      after = [ "-.mount" ];
+      wantedBy = ["sysinit.target"];
+      requires = ["-.mount"];
+      after = ["-.mount"];
       serviceConfig.Type = "oneshot";
       serviceConfig.RemainAfterExit = true;
       serviceConfig.ExecStart = ''${save-root}/bin/save-root /run/initial-root'';
     };
   };
 
-  options.disks-create = with lib; mkOption rec {
-    type = types.package;
-    default = with pkgs; symlinkJoin {
-      name = "disks-create";
-      paths = [ (writeScriptBin default.name partitionsCreateScript) parted ];
+  options.disks-create = with lib;
+    mkOption rec {
+      type = types.package;
+      default = with pkgs;
+        symlinkJoin {
+          name = "disks-create";
+          paths = [(writeScriptBin default.name partitionsCreateScript) parted];
+        };
     };
-  };
 
-  options.disks-format = with lib; mkOption rec {
-    type = types.package;
-    default = with pkgs; symlinkJoin {
-      name = "disks-format";
-      paths = [ (writeScriptBin default.name partitionsFormatScript) cryptsetup lvm2 dosfstools e2fsprogs btrfs-progs ];
+  options.disks-format = with lib;
+    mkOption rec {
+      type = types.package;
+      default = with pkgs;
+        symlinkJoin {
+          name = "disks-format";
+          paths = [(writeScriptBin default.name partitionsFormatScript) cryptsetup lvm2 dosfstools e2fsprogs btrfs-progs];
+        };
     };
-  };
 
-  options.disks-mount = with lib; mkOption rec {
-    type = types.package;
-    default = with pkgs; symlinkJoin {
-      name = "disks-mount";
-      paths = [ (writeScriptBin default.name partitionsMountScript) cryptsetup lvm2 ];
+  options.disks-mount = with lib;
+    mkOption rec {
+      type = types.package;
+      default = with pkgs;
+        symlinkJoin {
+          name = "disks-mount";
+          paths = [(writeScriptBin default.name partitionsMountScript) cryptsetup lvm2];
+        };
     };
-  };
-
 }
diff --git a/hardware/pc/hardware.nix b/hardware/pc/hardware.nix
index b62a323..df982bf 100644
--- a/hardware/pc/hardware.nix
+++ b/hardware/pc/hardware.nix
@@ -1,8 +1,13 @@
-{ config, lib, inputs, pkgs, modulesPath, ... }:
-let
-  powerMode = "performance";
-in
 {
+  config,
+  lib,
+  inputs,
+  pkgs,
+  modulesPath,
+  ...
+}: let
+  powerMode = "performance";
+in {
   imports = [
     ./disks.nix
     "${modulesPath}/profiles/all-hardware.nix"
@@ -10,20 +15,20 @@ in
 
   boot = {
     initrd = {
-      availableKernelModules = [ "xhci_pci" "usb_storage" "sd_mod" "sdhci_acpi" "aesni_intel" "cryptd" ];
-      kernelModules = [ ];
+      availableKernelModules = ["xhci_pci" "usb_storage" "sd_mod" "sdhci_acpi" "aesni_intel" "cryptd"];
+      kernelModules = [];
     };
     kernelPackages = pkgs.linuxPackages_latest;
-    kernelModules = [ "kvm_intel" "amdgpu" ];
-    extraModulePackages = [ ];
-    kernelParams = [ "boot.shell_on_fail" "net.ifnames=0" "biosdevname=0" "iomem=relaxed" "mitigations=off" ];
+    kernelModules = ["kvm_intel" "amdgpu"];
+    extraModulePackages = [];
+    kernelParams = ["boot.shell_on_fail" "net.ifnames=0" "biosdevname=0" "iomem=relaxed" "mitigations=off"];
   };
 
   powerManagement.cpuFreqGovernor = powerMode;
 
   services = {
     xserver = {
-      videoDrivers = [ "amdgpu" ];
+      videoDrivers = ["amdgpu"];
     };
     fstrim.enable = true;
   };
@@ -35,5 +40,4 @@ in
       enable = true;
     };
   };
-
 }