1
1
Fork 1
mirror of https://github.com/oddlama/nix-config.git synced 2025-10-11 07:10:39 +02:00

feat: add new machine "sentinel", a Hetzner Cloud server

This commit is contained in:
oddlama 2023-05-29 16:19:49 +02:00
parent d18e86f981
commit 97cb4e0ac5
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
11 changed files with 173 additions and 6 deletions

55
hosts/sentinel/fs.nix Normal file
View file

@ -0,0 +1,55 @@
{
config,
lib,
extraLib,
pkgs,
...
}: {
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/disk/by-id/${config.repo.secrets.local.disk.main}";
content = with extraLib.disko.gpt; {
type = "table";
format = "gpt";
partitions = [
(partEfi "efi" "0%" "512MiB")
(partLuksZfs "rpool" "512MiB" "100%")
];
};
};
};
zpool = with extraLib.disko.zfs; {
rpool =
defaultZpoolOptions
// {
datasets = {
"local" = unmountable;
"local/root" =
filesystem "/"
// {
postCreateHook = "zfs snapshot rpool/local/root@blank";
};
"local/nix" = filesystem "/nix";
"safe" = unmountable;
"safe/persist" = filesystem "/persist";
};
};
};
};
fileSystems."/persist".neededForBoot = true;
# After importing the rpool, rollback the root system to be empty.
boot.initrd.systemd.services.impermanence-root = {
wantedBy = ["initrd.target"];
after = ["zfs-import-rpool.service"];
before = ["sysroot.mount"];
unitConfig.DefaultDependencies = "no";
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.zfs}/bin/zfs rollback -r rpool/local/root@blank";
};
};
}