init
This commit is contained in:
155
hosts/nixos-testbed/disko-config.nix
Normal file
155
hosts/nixos-testbed/disko-config.nix
Normal file
@@ -0,0 +1,155 @@
|
||||
# sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode disko /nixos/hosts/nixos-testbed/disko-config.nix
|
||||
# time sudo nixos-install --flake /nixos#nixos-testbed
|
||||
{ lib, ... }:
|
||||
{
|
||||
# imports = [ inputs.disko.nixosModules.disko ];
|
||||
boot.zfs.extraPools = [ "rpool" ];
|
||||
boot.zfs.devNodes = "/dev/disk/by-path";
|
||||
boot.initrd.supportedFilesystems = [ "zfs" ];
|
||||
boot.supportedFilesystems = [ "zfs" ];
|
||||
|
||||
disko.devices = {
|
||||
disk = {
|
||||
broot = {
|
||||
type = "disk";
|
||||
device = "/dev/vda";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "512M";
|
||||
# start = "1MiB";
|
||||
# end = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
# start = "512M";
|
||||
# end = "100%";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "zfs";
|
||||
pool = "rpool";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
zpool = {
|
||||
rpool = {
|
||||
type = "zpool";
|
||||
|
||||
# Workaround: cannot import 'rpool': I/O error in disko tests
|
||||
# options.cachefile = "none";
|
||||
|
||||
# rootFsOptions = {
|
||||
# # I don't know.
|
||||
# # https://wiki.archlinux.org/title/Systemd#systemd-tmpfiles-setup.service_fails_to_start_at_boot
|
||||
# acltype = "posixacl";
|
||||
# # atime = "off";
|
||||
# # compression = "zstd";
|
||||
# mountpoint = "none";
|
||||
# # xattr = "sa";
|
||||
# "com.sun:auto-snapshot" = "false";
|
||||
# };
|
||||
|
||||
# mountpoint = "/";
|
||||
|
||||
datasets =
|
||||
let dataset = options:
|
||||
let default = {
|
||||
type = "zfs_fs";
|
||||
mountOptions = [ "noauto" ];
|
||||
options = {
|
||||
"com.sun:auto-snapshot" = "false";
|
||||
};
|
||||
};
|
||||
in lib.recursiveUpdate default options;
|
||||
in
|
||||
{
|
||||
"local" = dataset {};
|
||||
"darlings" = dataset {};
|
||||
"local/root" = dataset {
|
||||
mountpoint = "/";
|
||||
postCreateHook = ''
|
||||
zfs list -t snapshot -H -o name \
|
||||
| grep -E '^rpool/local/root@blank$' \
|
||||
|| zfs snapshot rpool/local/root@blank
|
||||
'';
|
||||
};
|
||||
"local/nix" = dataset { mountpoint = "/nix"; };
|
||||
"local/home" = dataset {
|
||||
mountpoint = "/home";
|
||||
postCreateHook = ''
|
||||
zfs list -t snapshot -H -o name \
|
||||
| grep -E '^rpool/local/home@blank$' \
|
||||
|| zfs snapshot rpool/local/home@blank
|
||||
'';
|
||||
};
|
||||
"darlings/persist" = dataset { mountpoint = "/persist"; };
|
||||
"darlings/home" = dataset {
|
||||
mountpoint = "/persist/home";
|
||||
};
|
||||
"reserved" = dataset {
|
||||
mountpoint = null;
|
||||
options = {
|
||||
canmount = "off";
|
||||
mountpoint = "none";
|
||||
reservation = "5GiB";
|
||||
};
|
||||
};
|
||||
# "local" = {
|
||||
# type = "zfs_fs";
|
||||
# options.mountpoint = "none";
|
||||
# };
|
||||
# "safe" = {
|
||||
# type = "zfs_fs";
|
||||
# options.mountpoint = "none";
|
||||
# };
|
||||
# "local/root" = {
|
||||
# type = "zfs_fs";
|
||||
# options.mountpoint = "legacy";
|
||||
# mountpoint = "/";
|
||||
# options."com.sun:auto-snapshot" = "false";
|
||||
# postCreateHook = ''
|
||||
# zfs list -t snapshot -H -o name \
|
||||
# | grep -E '^rpool/local/root@blank$' \
|
||||
# || zfs snapshot rpool/local/root@blank
|
||||
# '';
|
||||
# };
|
||||
# "local/home" = {
|
||||
|
||||
# };
|
||||
# "local/nix" = {
|
||||
# type = "zfs_fs";
|
||||
# options.mountpoint = "legacy";
|
||||
# mountpoint = "/nix";
|
||||
# options."com.sun:auto-snapshot" = "false";
|
||||
# };
|
||||
# "safe/persist" = {
|
||||
# type = "zfs_fs";
|
||||
# options.mountpoint = "legacy";
|
||||
# mountpoint = "/persist";
|
||||
# options."com.sun:auto-snapshot" = "false";
|
||||
# };
|
||||
# # zfs uses copy on write and requires some free space to delete files when the disk is completely filled
|
||||
# "reserved" = lib.recursiveUpdate (dataset "reserved") {
|
||||
# mountpoint = null;
|
||||
# options = {
|
||||
# canmount = "off";
|
||||
# mountpoint = "none";
|
||||
# reservation = "5GiB";
|
||||
# };
|
||||
# type = "zfs_fs";
|
||||
# };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
24
hosts/nixos-testbed/hardware-configuration.nix
Normal file
24
hosts/nixos-testbed/hardware-configuration.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
||||
1
hosts/nixos-testbed/system.nix
Normal file
1
hosts/nixos-testbed/system.nix
Normal file
@@ -0,0 +1 @@
|
||||
"x86_64-linux"
|
||||
Reference in New Issue
Block a user