feat: introduce treefmt and fmt all

This commit is contained in:
steveej 2024-11-15 10:17:56 +01:00
parent 80250b0179
commit 27c6c4f9fa
237 changed files with 5440 additions and 5214 deletions

View file

@ -3,20 +3,14 @@
vmPkgsPath,
buildPkgsPath,
nixosConfigPath,
}: let
buildPkgs = import buildPkgsPath {};
vmPkgs' = import vmPkgsPath {};
vmPkgs =
vmPkgs'
// {
runtimeShell = "${vmPkgs'.bash}/${vmPkgs'.bash.shellPath}";
};
}:
let
vmPkgs' = import vmPkgsPath { };
vmPkgs = vmPkgs' // {
runtimeShell = "${vmPkgs'.bash}/${vmPkgs'.bash.shellPath}";
};
importWithPkgs = {
path,
pkgs,
}: args:
import path (args // {inherit pkgs;});
importWithPkgs = { path, pkgs }: args: import path (args // { inherit pkgs; });
nixosConfig = importWithPkgs {
path = "${nixosConfigPath}";
@ -36,8 +30,10 @@
modules = [
nixosConfig
vmConfig
{virtualisation.useBootLoader = true;}
{ virtualisation.useBootLoader = true; }
];
})
.config;
in {vmWithBootLoaderMixed = vmWithBootLoaderConfigMixed.system.build.vm;}
}).config;
in
{
vmWithBootLoaderMixed = vmWithBootLoaderConfigMixed.system.build.vm;
}

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -x
rm *.qcow2
rm ./*.qcow2
rm result*
set -e
@ -8,9 +8,9 @@ BUILD_NIXPKGS="${BUILD_NIXPKGS:-${HOME}/src/github/NixOS/nixpkgs.dev}"
NIXOS_CONFIG="${NIXOS_CONFIG_OVERRIDE:-${PWD}/configuration.nix}"
nix-build -K --show-trace build-vm.nix \
--arg vmPkgsPath '<nixos-18.03>' \
--argstr buildPkgsPath "${BUILD_NIXPKGS}" \
--argstr nixosConfigPath "${NIXOS_CONFIG}" \
-A vmWithBootLoaderMixed
--arg vmPkgsPath '<nixos-18.03>' \
--argstr buildPkgsPath "${BUILD_NIXPKGS}" \
--argstr nixosConfigPath "${NIXOS_CONFIG}" \
-A vmWithBootLoaderMixed
./result/bin/run-*-vm
"./result/bin/run-*-vm"

View file

@ -1,9 +1,5 @@
{ lib, ... }:
{
pkgs,
lib,
...
}: let
in {
boot.loader.grub = {
enable = true;
version = 2;
@ -22,13 +18,23 @@ in {
allowDiscards = true;
}
];
fileSystems."/" = {label = "root";};
fileSystems."/" = {
label = "root";
};
fileSystems."/boot" = {label = "boot";};
fileSystems."/boot" = {
label = "boot";
};
boot.tmpOnTmpfs = true;
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"usb_storage"
"sd_mod"
"rtsx_pci_sdmmc"
];
users.extraUsers.root.initialPassword = lib.mkForce "toorroot";
users.mutableUsers = false;

View file

@ -1,3 +1,5 @@
#!/usr/bin/env bash
# /nix/store/lya9qyl9z5xb4vzdzh4vzcr7gfssk47z-qemu-host-cpu-only-for-vm-tests-2.12.0/bin/qemu-kvm \
# -cpu \
# kvm64 \
@ -24,7 +26,6 @@
# -drive \
# index=0,id=drive1,file=/home/steveej/src/steveej/nix-expressions/nixos.qcow2,cache=writeback,werror=report,if=virtio \
/nix/store/0i6fr8vv559a50w0vipvd22r0kkg1kx1-qemu-host-cpu-only-for-vm-tests-3.0.0/bin/qemu-kvm -cpu kvm64 -name nixos -m 384 -smp 1 -device virtio-rng-pci -net nic,netdev=user.0,model=virtio -netdev user,id=user.0 -virtfs local,path=/nix/store,security_model=none,mount_tag=store -virtfs local,path=/tmp/nix-vm.BXlbOnli8K/xchg,security_model=none,mount_tag=xchg -virtfs local,path=/tmp/nix-vm.BXlbOnli8K/xchg,security_model=none,mount_tag=shared \
-drive index=1,id=drive2,file=/tmp/nix-vm.BXlbOnli8K/disk.img,media=disk,if=virtio \
-drive index=0,id=drive1,file=/home/steveej/src/steveej/nix-expressions/tests/nixos.qcow2,cache=writeback,werror=report,if=virtio \
-drive index=1,id=drive2,file=/tmp/nix-vm.BXlbOnli8K/disk.img,media=disk,if=virtio \
-drive index=0,id=drive1,file=/home/steveej/src/steveej/nix-expressions/tests/nixos.qcow2,cache=writeback,werror=report,if=virtio

View file

@ -1,10 +1,4 @@
{
lib,
config,
pkgs,
fetchgit,
...
}: {
_: {
boot.consoleLogLevel = 6;
users.users.root.initialPassword = "root";
systemd.services."serial-getty@ttyS0".enable = true;