testbed-vm: init, will add hardware-configuration later
This commit is contained in:
parent
60c20af96a
commit
14ce01d5be
2 changed files with 107 additions and 0 deletions
11
hosts/testbed-vm/config.nix
Normal file
11
hosts/testbed-vm/config.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
{ config, pkgs, pkgs-stable, lib, inputs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[
|
||||||
|
./hardware/disko.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.hostName = "nixos-testbed";
|
||||||
|
networking.hostId = "6c3b53a1";
|
||||||
|
}
|
||||||
96
hosts/testbed-vm/hardware/disko.nix
Normal file
96
hosts/testbed-vm/hardware/disko.nix
Normal file
|
|
@ -0,0 +1,96 @@
|
||||||
|
{
|
||||||
|
disko.devices = {
|
||||||
|
disk = {
|
||||||
|
main = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/vda";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
ESP = {
|
||||||
|
size = "512M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
mountOptions = [ "umask=0077" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
luks = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "luks";
|
||||||
|
name = "crypted";
|
||||||
|
# Disable this if you do not want to allow TRIM requests to pass through LUKS
|
||||||
|
# (Security vs SSD longevity trade-off)
|
||||||
|
settings.allowDiscards = true;
|
||||||
|
# Uncomment if you want to use a keyfile during install:
|
||||||
|
# settings.keyFile = "/tmp/secret.key";
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = "zroot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zpool = {
|
||||||
|
zroot = {
|
||||||
|
type = "zpool";
|
||||||
|
options = {
|
||||||
|
ashift = "12";
|
||||||
|
autotrim = "on";
|
||||||
|
};
|
||||||
|
rootFsOptions = {
|
||||||
|
acltype = "posixacl";
|
||||||
|
xattr = "sa";
|
||||||
|
dnodesize = "auto";
|
||||||
|
compression = "zstd";
|
||||||
|
normalization = "formD";
|
||||||
|
relatime = "on";
|
||||||
|
canmount = "off";
|
||||||
|
# Prevent auto-snapshotting by default (enable explicitly on datasets that need it)
|
||||||
|
"com.sun:auto-snapshot" = "false";
|
||||||
|
};
|
||||||
|
datasets = {
|
||||||
|
# The ephemeral root dataset.
|
||||||
|
# We create a blank snapshot immediately so you can rollback to it on boot.
|
||||||
|
"root" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/";
|
||||||
|
options.mountpoint = "legacy";
|
||||||
|
postCreateHook = "zfs snapshot zroot/root@blank";
|
||||||
|
};
|
||||||
|
|
||||||
|
# The Nix Store (reproducible, doesn't need backing up usually)
|
||||||
|
"nix" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/nix";
|
||||||
|
options.mountpoint = "legacy";
|
||||||
|
options."com.sun:auto-snapshot" = "false";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Persisted state (for impermanence)
|
||||||
|
"persist" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/persist";
|
||||||
|
options.mountpoint = "legacy";
|
||||||
|
# Enable snapshots for data safety if using sanoid/syncoid
|
||||||
|
# options."com.sun:auto-snapshot" = "true";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Home directories
|
||||||
|
"home" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/home";
|
||||||
|
options.mountpoint = "legacy";
|
||||||
|
# options."com.sun:auto-snapshot" = "true";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue