2024-03-02 21:19:12 +01:00
|
|
|
# nix run github:nix-community/nixos-anywhere -- --copy-host-keys --disk-encryption-keys /run/secret.key /home/palo/orbi/run/secret.key --flake .#orbi root@95.216.66.212
|
2023-12-09 17:15:50 +01:00
|
|
|
{ config, lib, ... }:
|
|
|
|
let
|
2024-08-29 03:26:04 +02:00
|
|
|
disks = [
|
|
|
|
"sda"
|
|
|
|
"sdb"
|
|
|
|
];
|
2023-12-09 17:15:50 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
disko.devices = {
|
2024-08-29 03:26:04 +02:00
|
|
|
disk = lib.genAttrs disks (disk: {
|
|
|
|
type = "disk";
|
|
|
|
device = "/dev/${disk}";
|
|
|
|
content = {
|
|
|
|
type = "gpt";
|
|
|
|
partitions = {
|
|
|
|
boot = {
|
|
|
|
priority = 0;
|
|
|
|
size = "1M";
|
|
|
|
type = "EF02"; # for grub MBR
|
|
|
|
};
|
|
|
|
ESP = {
|
|
|
|
priority = 1;
|
|
|
|
size = "500M";
|
|
|
|
type = "EF00";
|
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
|
|
|
format = "vfat";
|
|
|
|
mountpoint = if disk == "sda" then "/boot" else "/boot_${disk}";
|
|
|
|
mountOptions = [ "defaults" ];
|
2024-02-26 09:44:59 +01:00
|
|
|
};
|
2024-08-29 03:26:04 +02:00
|
|
|
};
|
|
|
|
root = {
|
|
|
|
priority = 10;
|
|
|
|
size = "500G";
|
|
|
|
content = {
|
|
|
|
type = "luks";
|
|
|
|
name = "root_${disk}";
|
|
|
|
# if you want to use the key for interactive login be sure there is no trailing newline
|
|
|
|
# for example use `echo -n "password" > /run/secret.key`
|
|
|
|
# for example use `pass show hetzner/orbi/master_password | head -c -1 > /run/secret.key`
|
|
|
|
# or use nixos-anywhere --disk-encryption-keys /run/secret.key <local-path>
|
|
|
|
passwordFile = "/run/secret.key";
|
|
|
|
settings = {
|
|
|
|
allowDiscards = true;
|
2023-12-09 17:15:50 +01:00
|
|
|
};
|
|
|
|
content = {
|
2024-08-29 03:26:04 +02:00
|
|
|
type = "zfs";
|
|
|
|
pool = "zroot";
|
2023-12-09 17:15:50 +01:00
|
|
|
};
|
2024-02-26 09:44:59 +01:00
|
|
|
};
|
2024-08-29 03:26:04 +02:00
|
|
|
};
|
|
|
|
media = {
|
|
|
|
priority = 50;
|
|
|
|
size = "100%";
|
|
|
|
content = {
|
|
|
|
type = "luks";
|
|
|
|
# if you want to use the key for interactive login be sure there is no trailing newline
|
|
|
|
# for example use `echo -n "password" > /run/secret.key`
|
|
|
|
# for example use `pass show hetzner/orbi/master_password | head -c -1 > /run/secret.key`
|
|
|
|
# or use nixos-anywhere --disk-encryption-keys /run/secret.key <local-path>
|
|
|
|
passwordFile = "/run/secret.key";
|
|
|
|
settings = {
|
|
|
|
allowDiscards = true;
|
|
|
|
};
|
|
|
|
name = "media_${disk}";
|
2024-02-28 23:17:23 +01:00
|
|
|
content = {
|
2024-08-29 03:26:04 +02:00
|
|
|
type = "zfs";
|
|
|
|
pool = "zmedia";
|
2024-02-28 23:17:23 +01:00
|
|
|
};
|
|
|
|
};
|
2024-02-26 09:44:59 +01:00
|
|
|
};
|
2023-12-09 17:15:50 +01:00
|
|
|
};
|
2024-08-29 03:26:04 +02:00
|
|
|
};
|
|
|
|
});
|
2023-12-09 17:15:50 +01:00
|
|
|
|
|
|
|
zpool = {
|
|
|
|
|
|
|
|
zroot = {
|
|
|
|
type = "zpool";
|
2024-02-28 23:17:23 +01:00
|
|
|
mode = "mirror";
|
2023-12-09 17:15:50 +01:00
|
|
|
rootFsOptions = {
|
|
|
|
mountpoint = "none";
|
|
|
|
canmount = "off";
|
|
|
|
compression = "lz4";
|
|
|
|
};
|
|
|
|
datasets = {
|
|
|
|
"root" = {
|
|
|
|
type = "zfs_fs";
|
|
|
|
mountpoint = "/";
|
|
|
|
options = {
|
|
|
|
mountpoint = "legacy";
|
|
|
|
compression = "lz4";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
"store" = {
|
|
|
|
type = "zfs_fs";
|
|
|
|
mountpoint = "/nix/store";
|
|
|
|
options = {
|
|
|
|
mountpoint = "legacy";
|
|
|
|
compression = "lz4";
|
|
|
|
};
|
|
|
|
};
|
2024-04-11 19:51:10 +02:00
|
|
|
"nextcloud" = {
|
|
|
|
type = "zfs_fs";
|
|
|
|
mountpoint = "/var/lib/nixos-containers/nextcloud";
|
|
|
|
options = {
|
|
|
|
mountpoint = "legacy";
|
|
|
|
compression = "lz4";
|
|
|
|
"com.sun:auto-snapshot:hourly" = toString true;
|
|
|
|
"com.sun:auto-snapshot:daily" = toString true;
|
2024-06-22 19:31:50 +02:00
|
|
|
# "com.sun:auto-snapshot:weekly" = toString true;
|
|
|
|
# "com.sun:auto-snapshot:monthly" = toString true;
|
2024-04-11 19:51:10 +02:00
|
|
|
};
|
|
|
|
};
|
2024-05-19 01:17:45 +02:00
|
|
|
"matrix-terranix" = {
|
|
|
|
type = "zfs_fs";
|
|
|
|
mountpoint = "/var/lib/nixos-containers/matrix-terranix";
|
|
|
|
options = {
|
|
|
|
mountpoint = "legacy";
|
|
|
|
compression = "lz4";
|
|
|
|
"com.sun:auto-snapshot:hourly" = toString true;
|
|
|
|
"com.sun:auto-snapshot:daily" = toString true;
|
2024-06-22 19:31:50 +02:00
|
|
|
# "com.sun:auto-snapshot:weekly" = toString true;
|
|
|
|
# "com.sun:auto-snapshot:monthly" = toString true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
"surrealdb" = {
|
|
|
|
type = "zfs_fs";
|
|
|
|
mountpoint = "/var/lib/nixos-containers/surrealdb";
|
|
|
|
options = {
|
|
|
|
mountpoint = "legacy";
|
|
|
|
compression = "lz4";
|
|
|
|
"com.sun:auto-snapshot:hourly" = toString true;
|
|
|
|
#"com.sun:auto-snapshot:daily" = toString true;
|
|
|
|
#"com.sun:auto-snapshot:weekly" = toString true;
|
|
|
|
#"com.sun:auto-snapshot:monthly" = toString true;
|
|
|
|
};
|
|
|
|
};
|
2024-09-03 13:20:29 +02:00
|
|
|
"taskchampion" = {
|
|
|
|
type = "zfs_fs";
|
|
|
|
mountpoint = config.services.taskchampion-sync-server.dataDir;
|
|
|
|
# "/var/lib/taskchampion-sync-server";
|
|
|
|
options = {
|
|
|
|
mountpoint = "legacy";
|
|
|
|
compression = "lz4";
|
|
|
|
"com.sun:auto-snapshot:hourly" = toString true;
|
|
|
|
"com.sun:auto-snapshot:daily" = toString true;
|
|
|
|
#"com.sun:auto-snapshot:weekly" = toString true;
|
|
|
|
#"com.sun:auto-snapshot:monthly" = toString true;
|
|
|
|
};
|
|
|
|
};
|
2024-06-22 19:31:50 +02:00
|
|
|
"vikunja" = {
|
|
|
|
type = "zfs_fs";
|
|
|
|
mountpoint = "/var/lib/nixos-containers/vikunja";
|
|
|
|
options = {
|
|
|
|
mountpoint = "legacy";
|
|
|
|
compression = "lz4";
|
|
|
|
"com.sun:auto-snapshot:hourly" = toString true;
|
|
|
|
"com.sun:auto-snapshot:daily" = toString true;
|
|
|
|
#"com.sun:auto-snapshot:weekly" = toString true;
|
|
|
|
#"com.sun:auto-snapshot:monthly" = toString true;
|
2024-05-19 01:17:45 +02:00
|
|
|
};
|
|
|
|
};
|
2023-12-09 17:15:50 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# `zpool import -f zraid` once on the first boot and reboot
|
2024-02-28 23:17:23 +01:00
|
|
|
zmedia = {
|
|
|
|
type = "zpool";
|
|
|
|
rootFsOptions = {
|
|
|
|
mountpoint = "none";
|
|
|
|
canmount = "off";
|
|
|
|
};
|
|
|
|
datasets = {
|
2024-05-10 20:53:21 +02:00
|
|
|
media = {
|
2024-02-28 23:17:23 +01:00
|
|
|
type = "zfs_fs";
|
|
|
|
mountpoint = "/media";
|
|
|
|
options = {
|
|
|
|
mountpoint = "legacy";
|
|
|
|
compression = "lz4";
|
|
|
|
};
|
|
|
|
};
|
2024-05-10 23:17:45 +02:00
|
|
|
photoprism = {
|
|
|
|
type = "zfs_fs";
|
|
|
|
mountpoint = "/var/lib/nixos-containers/photoprism";
|
|
|
|
options = {
|
|
|
|
mountpoint = "legacy";
|
|
|
|
compression = "lz4";
|
|
|
|
"com.sun:auto-snapshot:hourly" = toString true;
|
|
|
|
"com.sun:auto-snapshot:daily" = toString true;
|
|
|
|
};
|
|
|
|
};
|
2024-02-28 23:17:23 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-12-09 17:15:50 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|