diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2024-12-30 11:35:14 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2024-12-30 11:35:14 +0100 |
commit | dce2c3c26a2ff9770bbba2a00471c03ab321c472 (patch) | |
tree | 91ce56182bab4dee87fd663ea70880446a15f7e7 /hardware | |
parent | Font: Change font style pt 1000 (diff) | |
download | nixos-config-dce2c3c26a2ff9770bbba2a00471c03ab321c472.tar.gz nixos-config-dce2c3c26a2ff9770bbba2a00471c03ab321c472.tar.bz2 nixos-config-dce2c3c26a2ff9770bbba2a00471c03ab321c472.zip |
fmt
Diffstat (limited to 'hardware')
-rw-r--r-- | hardware/chromebook/default.nix | 3 | ||||
-rw-r--r-- | hardware/chromebook/disks.nix | 77 | ||||
-rw-r--r-- | hardware/chromebook/hardware.nix | 27 | ||||
-rw-r--r-- | hardware/laptop/default.nix | 5 | ||||
-rw-r--r-- | hardware/laptop/disks.nix | 77 | ||||
-rw-r--r-- | hardware/laptop/hardware.nix | 26 | ||||
-rw-r--r-- | hardware/pc/default.nix | 5 | ||||
-rw-r--r-- | hardware/pc/disks.nix | 77 | ||||
-rw-r--r-- | hardware/pc/hardware.nix | 26 | ||||
-rw-r--r-- | hardware/thinkpad/default.nix | 4 | ||||
-rw-r--r-- | hardware/thinkpad/disks.nix | 77 | ||||
-rw-r--r-- | hardware/thinkpad/hardware.nix | 28 | ||||
-rw-r--r-- | hardware/virtualbox/default.nix | 5 | ||||
-rw-r--r-- | hardware/virtualbox/disks.nix | 77 | ||||
-rw-r--r-- | hardware/virtualbox/hardware.nix | 20 |
15 files changed, 296 insertions, 238 deletions
diff --git a/hardware/chromebook/default.nix b/hardware/chromebook/default.nix index 922f0a8..f8d36a4 100644 --- a/hardware/chromebook/default.nix +++ b/hardware/chromebook/default.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{...}: { imports = [ ./hardware.nix diff --git a/hardware/chromebook/disks.nix b/hardware/chromebook/disks.nix index c191b25..ff46d2e 100644 --- a/hardware/chromebook/disks.nix +++ b/hardware/chromebook/disks.nix @@ -1,5 +1,10 @@ -{ inputs, lib, config, pkgs, ... }: -let +{ + inputs, + lib, + config, + pkgs, + ... +}: let MMC = "/dev/disk/by-id/mmc-AGND3R_0x48d44fdc"; SD = "/dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000000208-0:0"; @@ -40,7 +45,7 @@ let partitionsMountScript = '' mount -t tmpfs none /mnt mkdir -p /mnt/{boot,nix,persist,home} - + cryptsetup open --type luks /dev/disk/by-partlabel/boot encrypted_boot mount /dev/mapper/encrypted_boot /mnt/boot mkdir -p /mnt/boot/efi @@ -62,16 +67,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" @@ -91,7 +94,7 @@ in fileSystems."/" = { device = "none"; fsType = "tmpfs"; - options = [ "defaults" "mode=755" ]; + options = ["defaults" "mode=755"]; }; boot.initrd.luks.devices."encrypted_boot" = { @@ -115,7 +118,7 @@ in device = "/dev/mapper/encrypted_nix"; fsType = "btrfs"; neededForBoot = true; - options = [ "compress-force=zstd" "noatime" ]; + options = ["compress-force=zstd" "noatime"]; }; boot.initrd.luks.devices."encrypted_home_and_persist".device = "/dev/disk/by-partlabel/home_and_persist"; @@ -124,22 +127,21 @@ in device = "/dev/mapper/encrypted_home_and_persist_pool-persist"; fsType = "btrfs"; neededForBoot = true; - options = [ "compress-force=zstd" "noatime" ]; + options = ["compress-force=zstd" "noatime"]; }; fileSystems."/home" = { device = "/dev/mapper/encrypted_home_and_persist_pool-home"; fsType = "btrfs"; - options = [ "compress-force=zstd" ]; + options = ["compress-force=zstd"]; }; services.btrfs.autoScrub.enable = true; - swapDevices = [ ]; + swapDevices = []; zramSwap.enable = true; - environment.systemPackages = [ config.disks-create config.disks-format @@ -150,37 +152,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/chromebook/hardware.nix b/hardware/chromebook/hardware.nix index e945c6d..df93eef 100644 --- a/hardware/chromebook/hardware.nix +++ b/hardware/chromebook/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 = { diff --git a/hardware/laptop/default.nix b/hardware/laptop/default.nix index b0125ee..df624c3 100644 --- a/hardware/laptop/default.nix +++ b/hardware/laptop/default.nix @@ -1,4 +1,3 @@ -{ ... }: -{ - imports = [ ./hardware.nix ]; +{...}: { + imports = [./hardware.nix]; } diff --git a/hardware/laptop/disks.nix b/hardware/laptop/disks.nix index 45202e5..a7df432 100644 --- a/hardware/laptop/disks.nix +++ b/hardware/laptop/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/wwn-0x5000c5009e0984c7"; 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/laptop/hardware.nix b/hardware/laptop/hardware.nix index bbd684b..bc1f3cb 100644 --- a/hardware/laptop/hardware.nix +++ b/hardware/laptop/hardware.nix @@ -1,28 +1,33 @@ -{ config, lib, inputs, pkgs, modulesPath, ... }: -let - powerMode = "performance"; -in { + config, + lib, + inputs, + pkgs, + modulesPath, + ... +}: let + powerMode = "performance"; +in { imports = [ ./disks.nix ]; boot = { initrd = { - availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" "sdhci_pci" ]; - kernelModules = [ ]; + availableKernelModules = ["xhci_pci" "ahci" "usbhid" "sd_mod" "sdhci_pci"]; + kernelModules = []; }; 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 = [ "nvidia" ]; + videoDrivers = ["nvidia"]; # Enable touchpad support (enabled default in most desktopManager). synaptics = { @@ -57,5 +62,4 @@ in }; }; }; - } 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; }; }; - } 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 ]; }; }; - } diff --git a/hardware/virtualbox/default.nix b/hardware/virtualbox/default.nix index b0125ee..df624c3 100644 --- a/hardware/virtualbox/default.nix +++ b/hardware/virtualbox/default.nix @@ -1,4 +1,3 @@ -{ ... }: -{ - imports = [ ./hardware.nix ]; +{...}: { + imports = [./hardware.nix]; } diff --git a/hardware/virtualbox/disks.nix b/hardware/virtualbox/disks.nix index 927e230..e1e2e55 100644 --- a/hardware/virtualbox/disks.nix +++ b/hardware/virtualbox/disks.nix @@ -1,5 +1,12 @@ -{ config, lib, inputs, pkgs, modulesPath, isIso, ... }: -let +{ + config, + lib, + inputs, + pkgs, + modulesPath, + isIso, + ... +}: let HDD = "/dev/disk/by-path/pci-0000:00:0d.0-ata-1"; 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/virtualbox/hardware.nix b/hardware/virtualbox/hardware.nix index b5ce8b7..8ac24b1 100644 --- a/hardware/virtualbox/hardware.nix +++ b/hardware/virtualbox/hardware.nix @@ -1,19 +1,24 @@ -{ config, lib, inputs, pkgs, modulesPath, ... }: { + config, + lib, + inputs, + pkgs, + modulesPath, + ... +}: { imports = [ ./disks.nix ]; boot = { initrd = { - availableKernelModules = - [ "ata_piix" "ohci_pci" "sd_mod" "sr_mod" ]; - kernelModules = [ ]; + availableKernelModules = ["ata_piix" "ohci_pci" "sd_mod" "sr_mod"]; + kernelModules = []; }; kernelPackages = pkgs.linuxPackages_latest; - kernelModules = [ ]; - extraModulePackages = [ ]; - kernelParams = [ "net.ifnames=0" "biosdevname=0" "mitigations=off" ]; + kernelModules = []; + extraModulePackages = []; + kernelParams = ["net.ifnames=0" "biosdevname=0" "mitigations=off"]; }; services.xserver = { @@ -32,5 +37,4 @@ }; virtualisation.virtualbox.guest.enable = true; - } |