Add impermanence setup to SIIT-DC
This commit is contained in:
parent
9c4a0ea9b5
commit
bfd56dd547
3 changed files with 96 additions and 1 deletions
|
@ -1,9 +1,13 @@
|
|||
{ ... }:
|
||||
{
|
||||
networking.hostId = "f1636fe0";
|
||||
imports = [
|
||||
../../shared/base.nix
|
||||
|
||||
../../shared/hardware/impermanence.nix
|
||||
../../shared/hardware/vm.nix
|
||||
../../shared/disko/hetzner-ext4.nix
|
||||
|
||||
../../shared/disko/hetzner-zfs-impermanence.nix
|
||||
|
||||
../../servers/siit-dc.nix
|
||||
];
|
||||
|
|
76
shared/disko/hetzner-zfs-impermanence.nix
Normal file
76
shared/disko/hetzner-zfs-impermanence.nix
Normal file
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
device = "/dev/sda";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
size = "1M";
|
||||
type = "EF02";
|
||||
priority = 1;
|
||||
};
|
||||
ESP = {
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
zfs = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "zfs";
|
||||
pool = "zroot";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
zpool = {
|
||||
zroot = {
|
||||
type = "zpool";
|
||||
rootFsOptions = {
|
||||
canmount = "off";
|
||||
compression = "zstd";
|
||||
};
|
||||
datasets = {
|
||||
root = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/";
|
||||
options.mountpoint = "legacy";
|
||||
postCreateHook = "zfs snapshot zroot/root@blank";
|
||||
};
|
||||
nix = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/nix";
|
||||
options.mountpoint = "legacy";
|
||||
};
|
||||
persist = {
|
||||
type = "zfs_fs";
|
||||
options = {
|
||||
mountpoint = "legacy";
|
||||
"com.sun:auto-snapshot" = "true";
|
||||
};
|
||||
mountpoint = "/persist";
|
||||
};
|
||||
home = {
|
||||
type = "zfs_fs";
|
||||
options = {
|
||||
mountpoint = "legacy";
|
||||
"com.sun:auto-snapshot" = "true";
|
||||
};
|
||||
mountpoint = "/home";
|
||||
postCreateHook = "zfs snapshot zroot/home@blank";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
15
shared/hardware/impermanence.nix
Normal file
15
shared/hardware/impermanence.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
services.zfs = {
|
||||
autoScrub.enable = true;
|
||||
autoSnapshot = {
|
||||
enable = true;
|
||||
flags = "-k -p --utc";
|
||||
};
|
||||
};
|
||||
|
||||
boot.initrd.postResumeCommands = lib.mkAfter ''
|
||||
zfs rollback -r zroot/root@blank
|
||||
zfs rollback -r zroot/home@blank
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue