Moar progress

This commit is contained in:
caem 2025-01-12 02:57:46 +01:00
parent 9c5f454a1c
commit 4830f943b4
Signed by: caem
GPG key ID: 69A830D03203405F
11 changed files with 219 additions and 16 deletions

50
hosts/vm/default.nix Normal file
View file

@ -0,0 +1,50 @@
{ pkgs, lib, ... }:
{
imports = [
./disko.nix
./packages.nix
];
users.allowNoPasswordLogin = true; /* DEBUG */
time.timeZone = "Europe/Berlin";
networking = {
hostName = "vm";
useDHCP = lib.mkDefault true;
};
boot = {
loader = {
grub = {
enable = true;
device = "/dev/nvme0n1"; # [managed by install.sh] { grub device }
gfxmodeEfi = "1920x1080";
};
};
tmp.useTmpfs = true;
kernelPackages = pkgs.linuxPackages_xanmod_latest;
supportedFilesystems = [ "btfs" "vfat" "xfs" ];
initrd = {
availableKernelModules = [ "nvme" "xhci_pci" "ahci"
"usbhid" "usb_storage" "sd_mod" ];
};
};
services = {
fstrim.enable = true;
btrfs.autoScrub.enable = true;
};
fileSystems = {
# These are system specific. If you have any additional drives that are not
# your root device you can add and mount them here. Added nofail so that you can
# install this configuration on a device without it exploding when you don't have
# these specific partitions.
};
system.stateVersion = "24.11"; # [managed by install.sh] { state version }
}

64
hosts/vm/disko.nix Normal file
View file

@ -0,0 +1,64 @@
{ ... }:
{
disko.devices = {
disk = {
master = {
type = "disk";
device = ""; # [managed by install.sh] { device }
content = {
type = "gpt";
partitions = {
ESP = {
priority = 1;
name = "efi";
start = "1M";
end = "1024M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"umask=0077"
"noatime"
];
};
};
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" "-L nixos" ];
postCreateHook = ''
TMP_MNT=$(mktemp -d)
MNT_PART="" # [managed by install.sh] { root partition }
mount "$MNT_PART" "$TMP_MNT" -o subvol=/
trap 'umount "$TMP_MNT"; rm -rf "$TMP_MNT"' EXIT
btrfs subvolume snapshot "$TMP_MNT/root" "$TMP_MNT/blank"
'';
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = [
"noatime"
"compress=zstd"
];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [
"noatime"
"compress=zstd"
];
};
};
};
};
};
};
};
};
};
}

14
hosts/vm/packages.nix Normal file
View file

@ -0,0 +1,14 @@
{ ... }:
{
imports = let
modules = ../../modules/nixos;
in [
"${modules}/core"
"${modules}/hardware/audio"
"${modules}/hardware/gpu/graphics.nix"
"${modules}/multimedia"
"${modules}/desktop/gnome"
];
}