From dce2c3c26a2ff9770bbba2a00471c03ab321c472 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Mon, 30 Dec 2024 11:35:14 +0100 Subject: fmt --- hardware/thinkpad/default.nix | 4 +-- hardware/thinkpad/disks.nix | 77 +++++++++++++++++++++++------------------- hardware/thinkpad/hardware.nix | 28 ++++++++------- 3 files changed, 60 insertions(+), 49 deletions(-) (limited to 'hardware/thinkpad') diff --git a/hardware/thinkpad/default.nix b/hardware/thinkpad/default.nix index adc1519..67d1fd5 100644 --- a/hardware/thinkpad/default.nix +++ b/hardware/thinkpad/default.nix @@ -1,5 +1,4 @@ -{ pkgs, ... }: -{ +{pkgs, ...}: { imports = [ ./hardware.nix @@ -25,5 +24,4 @@ ectool cbmem ]; - } diff --git a/hardware/thinkpad/disks.nix b/hardware/thinkpad/disks.nix index 543c24c..c5a9ec9 100644 --- a/hardware/thinkpad/disks.nix +++ b/hardware/thinkpad/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/ata-CT250MX500SSD1_1918E2006A3A"; partitionsCreateScript = '' @@ -54,16 +61,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" @@ -83,7 +88,7 @@ in fileSystems."/" = { device = "none"; fsType = "tmpfs"; - options = [ "defaults" "mode=755" ]; + options = ["defaults" "mode=755"]; }; boot.initrd.luks.devices."encrypted_boot" = { @@ -107,29 +112,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 @@ -140,37 +144,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/thinkpad/hardware.nix b/hardware/thinkpad/hardware.nix index f3f3f5c..acc9cb5 100644 --- a/hardware/thinkpad/hardware.nix +++ b/hardware/thinkpad/hardware.nix @@ -1,29 +1,34 @@ -{ config, lib, inputs, pkgs, modulesPath, ... }: -let - powerMode = "schedutil"; -in { + config, + lib, + inputs, + pkgs, + modulesPath, + ... +}: let + powerMode = "schedutil"; +in { imports = [ ./disks.nix ]; boot = { - blacklistedKernelModules = [ "uvcvideo" ]; + blacklistedKernelModules = ["uvcvideo"]; initrd = { - availableKernelModules = [ "xhci_pci" "usb_storage" "sd_mod" "sdhci_acpi" "aesni_intel" "cryptd" ]; - kernelModules = [ "i915" ]; + availableKernelModules = ["xhci_pci" "usb_storage" "sd_mod" "sdhci_acpi" "aesni_intel" "cryptd"]; + kernelModules = ["i915"]; }; kernelPackages = pkgs.linuxPackages_latest; - kernelModules = [ "kvm_intel" ]; - extraModulePackages = [ ]; - kernelParams = [ "net.ifnames=0" "biosdevname=0" "iomem=relaxed" "mitigations=off" ]; + kernelModules = ["kvm_intel"]; + extraModulePackages = []; + kernelParams = ["net.ifnames=0" "biosdevname=0" "iomem=relaxed" "mitigations=off"]; }; powerManagement.cpuFreqGovernor = powerMode; services = { xserver = { - videoDrivers = [ "intel" ]; + videoDrivers = ["intel"]; # Enable touchpad support (enabled default in most desktopManager). synaptics = { @@ -50,5 +55,4 @@ in ]; }; }; - } -- cgit 1.4.1