2022-07-31 11:03:59 +02:00
|
|
|
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
secret,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
2021-09-14 21:59:53 +02:00
|
|
|
cfg = config.magic_rb.hardware.blowhole;
|
|
|
|
in {
|
|
|
|
options.magic_rb.hardware.blowhole = mkEnableOption "Enable blowhole.";
|
|
|
|
|
|
|
|
config = mkIf cfg {
|
|
|
|
boot = {
|
2022-07-31 11:03:59 +02:00
|
|
|
supportedFilesystems = ["zfs"];
|
2021-10-18 00:13:22 +02:00
|
|
|
initrd.availableKernelModules = [
|
|
|
|
"xhci_pci"
|
|
|
|
"ahci"
|
|
|
|
"usbhid"
|
|
|
|
"usb_storage"
|
|
|
|
"sd_mod"
|
|
|
|
"nvme"
|
|
|
|
];
|
|
|
|
zfs.enableUnstable = true;
|
2023-02-10 00:34:17 +01:00
|
|
|
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
2021-09-14 21:59:53 +02:00
|
|
|
};
|
|
|
|
|
2023-02-14 20:18:11 +01:00
|
|
|
hardware.enableRedistributableFirmware = true;
|
|
|
|
|
2022-07-31 11:03:59 +02:00
|
|
|
fileSystems =
|
|
|
|
{
|
|
|
|
"/boot" = {
|
2021-10-18 00:13:22 +02:00
|
|
|
device = "/dev/disk/by-uuid/738acc32-3e2e-4986-987c-40264153d5bf";
|
2021-09-14 21:59:53 +02:00
|
|
|
fsType = "ext4";
|
|
|
|
};
|
2022-07-31 11:03:59 +02:00
|
|
|
"/" = {
|
2021-10-18 00:13:22 +02:00
|
|
|
device = "blowhole-zpool/local/root";
|
|
|
|
fsType = "zfs";
|
|
|
|
};
|
2022-07-31 11:03:59 +02:00
|
|
|
"/nix" = {
|
2021-10-18 00:13:22 +02:00
|
|
|
device = "blowhole-zpool/local/nix";
|
|
|
|
fsType = "zfs";
|
|
|
|
};
|
|
|
|
|
2022-07-31 11:03:59 +02:00
|
|
|
"/var/nfs" = {
|
2021-10-18 00:13:22 +02:00
|
|
|
device = "/dev/disk/by-uuid/e06f6d2c-e434-4eec-b00d-b13c1ecc96f0";
|
|
|
|
fsType = "btrfs";
|
2022-07-31 11:03:59 +02:00
|
|
|
options = [
|
|
|
|
"subvol=/nfs"
|
|
|
|
"noatime"
|
|
|
|
];
|
2021-10-18 00:13:22 +02:00
|
|
|
};
|
|
|
|
|
2022-07-31 11:03:59 +02:00
|
|
|
"/old-root" = {
|
2021-10-18 00:13:22 +02:00
|
|
|
device = "/dev/disk/by-uuid/e06f6d2c-e434-4eec-b00d-b13c1ecc96f0";
|
|
|
|
fsType = "btrfs";
|
2022-07-31 11:03:59 +02:00
|
|
|
options = [
|
|
|
|
"subvol=/arch"
|
|
|
|
"noatime"
|
|
|
|
];
|
2021-10-18 00:13:22 +02:00
|
|
|
};
|
2022-07-31 11:03:59 +02:00
|
|
|
"/var/lib/nomad" = {
|
2022-09-26 18:45:58 +02:00
|
|
|
device = "blowhole-zpool/persist/nomad";
|
|
|
|
fsType = "zfs";
|
2021-10-18 00:13:22 +02:00
|
|
|
};
|
2022-07-31 11:03:59 +02:00
|
|
|
"/var/secrets" = {
|
2021-10-18 00:13:22 +02:00
|
|
|
device = "blowhole-zpool/persist/secrets";
|
|
|
|
fsType = "zfs";
|
|
|
|
};
|
2022-07-31 11:03:59 +02:00
|
|
|
"/var/lib/consul" = {
|
2021-10-18 00:13:22 +02:00
|
|
|
device = "/old-root/var/lib/consul";
|
|
|
|
options = singleton "bind";
|
|
|
|
};
|
2022-07-31 11:03:59 +02:00
|
|
|
"/var/lib/vault" = {
|
2021-10-18 00:13:22 +02:00
|
|
|
device = "/old-root/var/lib/vault";
|
|
|
|
options = singleton "bind";
|
|
|
|
};
|
2022-07-31 11:03:59 +02:00
|
|
|
}
|
2022-11-23 20:48:59 +01:00
|
|
|
// secret.mounts.blowhole or {};
|
2021-09-14 21:59:53 +02:00
|
|
|
};
|
|
|
|
}
|