feat: format via 'ls **/*.nix | each { |it| nixfmt $it.name }'

This commit is contained in:
Ryan Yin
2025-07-30 12:17:24 +08:00
parent d10b30b06b
commit 13bb77108c
219 changed files with 2103 additions and 1728 deletions

View File

@@ -6,7 +6,7 @@
fileSystems."/run/media/nixos_k3s" = {
device = "/dev/disk/by-label/NIXOS_K3S";
fsType = "vfat";
options = ["ro"];
options = [ "ro" ];
};
disko.devices = {
@@ -76,7 +76,7 @@
];
content = {
type = "btrfs";
extraArgs = ["-f"]; # Force override existing partition
extraArgs = [ "-f" ]; # Force override existing partition
subvolumes = {
# mount the top-level subvolume at /btr_pool
# it will be used by btrbk to create snapshots
@@ -84,23 +84,35 @@
mountpoint = "/btr_pool";
# btrfs's top-level subvolume, internally has an id 5
# we can access all other subvolumes from this subvolume.
mountOptions = ["subvolid=5"];
mountOptions = [ "subvolid=5" ];
};
"@nix" = {
mountpoint = "/nix";
mountOptions = ["compress-force=zstd:1" "noatime"];
mountOptions = [
"compress-force=zstd:1"
"noatime"
];
};
"@persistent" = {
mountpoint = "/persistent";
mountOptions = ["compress-force=zstd:1" "noatime"];
mountOptions = [
"compress-force=zstd:1"
"noatime"
];
};
"@tmp" = {
mountpoint = "/tmp";
mountOptions = ["compress-force=zstd:1" "noatime"];
mountOptions = [
"compress-force=zstd:1"
"noatime"
];
};
"@snapshots" = {
mountpoint = "/snapshots";
mountOptions = ["compress-force=zstd:1" "noatime"];
mountOptions = [
"compress-force=zstd:1"
"noatime"
];
};
"@swap" = {
mountpoint = "/swap";

View File

@@ -4,7 +4,8 @@
myvars,
mylib,
...
}: let
}:
let
hostName = "k3s-prod-1-master-1"; # Define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
@@ -28,11 +29,10 @@
# "--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
# ];
};
in {
imports =
(mylib.scanPaths ./.)
++ [
coreModule
k3sModule
];
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}

View File

@@ -4,7 +4,8 @@
myvars,
mylib,
...
}: let
}:
let
hostName = "k3s-prod-1-master-2"; # define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
@@ -27,11 +28,10 @@
# "--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
# ];
};
in {
imports =
(mylib.scanPaths ./.)
++ [
coreModule
k3sModule
];
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}

View File

@@ -4,7 +4,8 @@
myvars,
mylib,
...
}: let
}:
let
hostName = "k3s-prod-1-master-3"; # define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
@@ -27,11 +28,10 @@
# "--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
# ];
};
in {
imports =
(mylib.scanPaths ./.)
++ [
coreModule
k3sModule
];
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}

View File

@@ -4,7 +4,8 @@
myvars,
mylib,
...
}: let
}:
let
hostName = "k3s-prod-1-worker-1"; # define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
@@ -26,11 +27,10 @@
# "--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
# ];
};
in {
imports =
(mylib.scanPaths ./.)
++ [
coreModule
k3sModule
];
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}

View File

@@ -4,7 +4,8 @@
myvars,
mylib,
...
}: let
}:
let
hostName = "k3s-prod-1-worker-2"; # define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
@@ -26,11 +27,10 @@
# "--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
# ];
};
in {
imports =
(mylib.scanPaths ./.)
++ [
coreModule
k3sModule
];
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}

View File

@@ -4,7 +4,8 @@
myvars,
mylib,
...
}: let
}:
let
hostName = "k3s-prod-1-worker-3"; # define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
@@ -26,11 +27,10 @@
# "--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
# ];
};
in {
imports =
(mylib.scanPaths ./.)
++ [
coreModule
k3sModule
];
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}

View File

@@ -4,7 +4,8 @@
myvars,
mylib,
...
}: let
}:
let
hostName = "k3s-test-1-master-1"; # Define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
@@ -29,11 +30,10 @@
# "--service-cidr=172.19.0.0/16,fdfd:cafe:00:8002::/112"
# ];
};
in {
imports =
(mylib.scanPaths ./.)
++ [
coreModule
k3sModule
];
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}

View File

@@ -4,7 +4,8 @@
myvars,
mylib,
...
}: let
}:
let
hostName = "k3s-test-1-master-2"; # define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
@@ -27,11 +28,10 @@
# "--service-cidr=172.19.0.0/16,fdfd:cafe:00:8002::/112"
# ];
};
in {
imports =
(mylib.scanPaths ./.)
++ [
coreModule
k3sModule
];
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}

View File

@@ -4,7 +4,8 @@
myvars,
mylib,
...
}: let
}:
let
hostName = "k3s-test-1-master-3"; # define your hostname.
coreModule = mylib.genKubeVirtGuestModule {
@@ -27,11 +28,10 @@
# "--service-cidr=172.19.0.0/16,fdfd:cafe:00:8002::/112"
# ];
};
in {
imports =
(mylib.scanPaths ./.)
++ [
coreModule
k3sModule
];
in
{
imports = (mylib.scanPaths ./.) ++ [
coreModule
k3sModule
];
}

View File

@@ -5,7 +5,8 @@
myvars,
disko,
...
}: let
}:
let
# MoreFine - S500Plus
hostName = "kubevirt-shoryu"; # Define your hostname.
@@ -45,17 +46,16 @@
# so we should not disable flannel here.
disableFlannel = false;
};
in {
imports =
(mylib.scanPaths ./.)
++ [
disko.nixosModules.default
../disko-config/kubevirt-disko-fs.nix
./hardware-configuration.nix
./preservation.nix
coreModule
k3sModule
];
in
{
imports = (mylib.scanPaths ./.) ++ [
disko.nixosModules.default
../disko-config/kubevirt-disko-fs.nix
./hardware-configuration.nix
./preservation.nix
coreModule
k3sModule
];
boot.kernelParams = [
# disable transparent hugepage(allocate hugepages dynamically)

View File

@@ -4,7 +4,8 @@
pkgs,
modulesPath,
...
}: {
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
@@ -18,12 +19,25 @@
# clear /tmp on boot to get a stateless /tmp directory.
boot.tmp.cleanOnBoot = true;
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"];
boot.kernelModules = ["kvm-amd" "vfio-pci"];
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.kernelModules = [
"kvm-amd"
"vfio-pci"
];
boot.extraModprobeConfig = "options kvm_amd nested=1"; # for amd cpu
# Enable binfmt emulation of aarch64-linux, this is required for cross compilation.
boot.binfmt.emulatedSystems = ["aarch64-linux" "riscv64-linux"];
boot.binfmt.emulatedSystems = [
"aarch64-linux"
"riscv64-linux"
];
# supported file systems, so we can mount any removable disks with these filesystems
boot.supportedFilesystems = [
"ext4"

View File

@@ -3,9 +3,11 @@
pkgs,
myvars,
...
}: let
}:
let
inherit (myvars) username;
in {
in
{
imports = [
preservation.nixosModules.default
];
@@ -68,25 +70,27 @@ in {
# Note that immediate parent directories of persisted files can also be
# configured with ownership and permissions from the `parent` settings if
# `configureParent = true` is set for the file.
systemd.tmpfiles.settings.preservation = let
permission = {
user = username;
group = "users";
mode = "0755";
systemd.tmpfiles.settings.preservation =
let
permission = {
user = username;
group = "users";
mode = "0755";
};
in
{
"/home/${username}/.config".d = permission;
"/home/${username}/.local".d = permission;
"/home/${username}/.local/share".d = permission;
"/home/${username}/.local/state".d = permission;
"/home/${username}/.terraform.d".d = permission;
};
in {
"/home/${username}/.config".d = permission;
"/home/${username}/.local".d = permission;
"/home/${username}/.local/share".d = permission;
"/home/${username}/.local/state".d = permission;
"/home/${username}/.terraform.d".d = permission;
};
# systemd-machine-id-commit.service would fail but it is not relevant
# in this specific setup for a persistent machine-id so we disable it
#
# see the firstboot example below for an alternative approach
systemd.suppressedSystemUnits = ["systemd-machine-id-commit.service"];
systemd.suppressedSystemUnits = [ "systemd-machine-id-commit.service" ];
# let the service commit the transient ID to the persistent volume
systemd.services.systemd-machine-id-commit = {

View File

@@ -5,7 +5,8 @@
myvars,
disko,
...
}: let
}:
let
hostName = "kubevirt-shushou"; # Define your hostname.
coreModule = mylib.genKubeVirtHostModule {
@@ -39,17 +40,16 @@
];
disableFlannel = false;
};
in {
imports =
(mylib.scanPaths ./.)
++ [
disko.nixosModules.default
../disko-config/kubevirt-disko-fs.nix
../kubevirt-shoryu/hardware-configuration.nix
../kubevirt-shoryu/preservation.nix
coreModule
k3sModule
];
in
{
imports = (mylib.scanPaths ./.) ++ [
disko.nixosModules.default
../disko-config/kubevirt-disko-fs.nix
../kubevirt-shoryu/hardware-configuration.nix
../kubevirt-shoryu/preservation.nix
coreModule
k3sModule
];
boot.kernelParams = [
# disable transparent hugepage(allocate hugepages dynamically)

View File

@@ -5,7 +5,8 @@
myvars,
disko,
...
}: let
}:
let
hostName = "kubevirt-youko"; # Define your hostname.
coreModule = mylib.genKubeVirtHostModule {
@@ -39,17 +40,16 @@
];
disableFlannel = false;
};
in {
imports =
(mylib.scanPaths ./.)
++ [
disko.nixosModules.default
../disko-config/kubevirt-disko-fs.nix
../kubevirt-shoryu/hardware-configuration.nix
../kubevirt-shoryu/preservation.nix
coreModule
k3sModule
];
in
{
imports = (mylib.scanPaths ./.) ++ [
disko.nixosModules.default
../disko-config/kubevirt-disko-fs.nix
../kubevirt-shoryu/hardware-configuration.nix
../kubevirt-shoryu/preservation.nix
coreModule
k3sModule
];
boot.kernelParams = [
# disable transparent hugepage(allocate hugepages dynamically)