From dce2c3c26a2ff9770bbba2a00471c03ab321c472 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Mon, 30 Dec 2024 11:35:14 +0100 Subject: fmt --- hardware/virtualbox/default.nix | 5 ++- hardware/virtualbox/disks.nix | 77 ++++++++++++++++++++++------------------ hardware/virtualbox/hardware.nix | 20 ++++++----- 3 files changed, 57 insertions(+), 45 deletions(-) (limited to 'hardware/virtualbox') 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; - } -- cgit 1.4.1