build01: migrate to disko config
This commit is contained in:
parent
3af52025ce
commit
4c68367b89
5 changed files with 78 additions and 75 deletions
|
@ -165,6 +165,10 @@
|
||||||
remote-workers = ./modules/nixos/remote-workers.nix;
|
remote-workers = ./modules/nixos/remote-workers.nix;
|
||||||
watch-store = ./modules/nixos/watch-store.nix;
|
watch-store = ./modules/nixos/watch-store.nix;
|
||||||
zfs = ./modules/nixos/zfs.nix;
|
zfs = ./modules/nixos/zfs.nix;
|
||||||
|
disko-raid.imports = [
|
||||||
|
inputs.disko.nixosModules.disko
|
||||||
|
./modules/nixos/disko-raid.nix
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
flake.lib.darwinSystem = args:
|
flake.lib.darwinSystem = args:
|
||||||
|
|
|
@ -1,22 +1,13 @@
|
||||||
{ inputs, ... }:
|
{ inputs, ... }:
|
||||||
# Boot recovery:
|
|
||||||
# Activate 64-bit Rescue system in https://robot.your-server.de/server
|
|
||||||
# ssh root@build01.nix-community.org "mount /dev/md[0-9]* /mnt && /mnt/kexec_bundle"
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# In kexec image:
|
|
||||||
# # stop autoreboot
|
|
||||||
# $ systemctl stop autoreboot.timer
|
|
||||||
# $ zpool import -f zroot && mount -t zfs zroot/root /mnt && mount -t zfs zroot/root/home /mnt/home && mount -t zfs zroot/root/nix /mnt/nix && mount /dev/md[0-9]* /mnt/boot
|
|
||||||
# nixos-enter
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
inputs.srvos.nixosModules.hardware-hetzner-online-amd
|
inputs.srvos.nixosModules.hardware-hetzner-online-amd
|
||||||
inputs.self.nixosModules.common
|
inputs.self.nixosModules.common
|
||||||
|
inputs.self.nixosModules.disko-raid
|
||||||
inputs.self.nixosModules.builder
|
inputs.self.nixosModules.builder
|
||||||
inputs.self.nixosModules.zfs
|
|
||||||
inputs.self.nixosModules.community-builder
|
inputs.self.nixosModules.community-builder
|
||||||
];
|
];
|
||||||
|
nixCommunity.disko.raidLevel = 0; # more disk space, we don't have state to restore anyway
|
||||||
|
|
||||||
# Emulate riscv64 until we have proper builders
|
# Emulate riscv64 until we have proper builders
|
||||||
boot.binfmt.emulatedSystems = [ "riscv64-linux" ];
|
boot.binfmt.emulatedSystems = [ "riscv64-linux" ];
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{ inputs, ... }:
|
{ inputs, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
inputs.disko.nixosModules.disko
|
|
||||||
inputs.srvos.nixosModules.mixins-nginx
|
inputs.srvos.nixosModules.mixins-nginx
|
||||||
inputs.srvos.nixosModules.hardware-hetzner-online-amd
|
inputs.srvos.nixosModules.hardware-hetzner-online-amd
|
||||||
inputs.self.nixosModules.common
|
inputs.self.nixosModules.common
|
||||||
|
inputs.self.nixosModules.disko-raid
|
||||||
inputs.self.nixosModules.buildbot
|
inputs.self.nixosModules.buildbot
|
||||||
inputs.self.nixosModules.builder
|
inputs.self.nixosModules.builder
|
||||||
inputs.self.nixosModules.hercules-ci
|
inputs.self.nixosModules.hercules-ci
|
||||||
|
@ -14,7 +14,6 @@
|
||||||
inputs.self.nixosModules.github-org-backup
|
inputs.self.nixosModules.github-org-backup
|
||||||
inputs.self.nixosModules.hydra
|
inputs.self.nixosModules.hydra
|
||||||
inputs.self.nixosModules.nur-update
|
inputs.self.nixosModules.nur-update
|
||||||
./disko.nix
|
|
||||||
./postgresql.nix
|
./postgresql.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
{ lib, ... }:
|
|
||||||
let
|
|
||||||
mirrorBoot = idx: {
|
|
||||||
type = "disk";
|
|
||||||
device = "/dev/nvme${idx}n1";
|
|
||||||
content = {
|
|
||||||
type = "gpt";
|
|
||||||
partitions = {
|
|
||||||
boot = {
|
|
||||||
size = "1M";
|
|
||||||
type = "EF02"; # for grub MBR
|
|
||||||
};
|
|
||||||
ESP = {
|
|
||||||
size = "1G";
|
|
||||||
type = "EF00";
|
|
||||||
content = {
|
|
||||||
type = "filesystem";
|
|
||||||
format = "vfat";
|
|
||||||
mountpoint = "/boot${idx}";
|
|
||||||
mountOptions = [ "nofail" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
raid-root = {
|
|
||||||
size = "100%";
|
|
||||||
content = {
|
|
||||||
type = "mdraid";
|
|
||||||
name = "root";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
# this is both efi and bios compatible
|
|
||||||
boot.loader.grub = {
|
|
||||||
enable = true;
|
|
||||||
efiSupport = true;
|
|
||||||
efiInstallAsRemovable = true;
|
|
||||||
devices = lib.mkForce [ ]; # disko adds /boot here, we want /boot0 /boot1
|
|
||||||
mirroredBoots = [
|
|
||||||
{ path = "/boot0"; devices = [ "/dev/nvme0n1" ]; }
|
|
||||||
{ path = "/boot1"; devices = [ "/dev/nvme1n1" ]; }
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
disko.devices = {
|
|
||||||
disk = {
|
|
||||||
x = mirrorBoot "0";
|
|
||||||
y = mirrorBoot "1";
|
|
||||||
};
|
|
||||||
mdadm.root = {
|
|
||||||
type = "mdadm";
|
|
||||||
level = 1;
|
|
||||||
content = {
|
|
||||||
type = "filesystem";
|
|
||||||
format = "ext4";
|
|
||||||
mountpoint = "/";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
71
modules/nixos/disko-raid.nix
Normal file
71
modules/nixos/disko-raid.nix
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
{ lib, config, ... }:
|
||||||
|
let
|
||||||
|
mirrorBoot = idx: {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/nvme${idx}n1";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
boot = {
|
||||||
|
size = "1M";
|
||||||
|
type = "EF02"; # for grub MBR
|
||||||
|
};
|
||||||
|
ESP = {
|
||||||
|
size = "1G";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot${idx}";
|
||||||
|
mountOptions = [ "nofail" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
raid-root = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "mdraid";
|
||||||
|
name = "root";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
nixCommunity.disko.raidLevel = lib.mkOption {
|
||||||
|
type = lib.types.int;
|
||||||
|
default = 1;
|
||||||
|
description = "RAID level to use for the root partition";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = {
|
||||||
|
# this is both efi and bios compatible
|
||||||
|
boot.loader.grub = {
|
||||||
|
enable = true;
|
||||||
|
efiSupport = true;
|
||||||
|
efiInstallAsRemovable = true;
|
||||||
|
devices = lib.mkForce [ ]; # disko adds /boot here, we want /boot0 /boot1
|
||||||
|
mirroredBoots = [
|
||||||
|
{ path = "/boot0"; devices = [ "/dev/nvme0n1" ]; }
|
||||||
|
{ path = "/boot1"; devices = [ "/dev/nvme1n1" ]; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
disko.devices = {
|
||||||
|
disk = {
|
||||||
|
x = mirrorBoot "0";
|
||||||
|
y = mirrorBoot "1";
|
||||||
|
};
|
||||||
|
mdadm.root = {
|
||||||
|
type = "mdadm";
|
||||||
|
level = config.nixCommunity.disko.raidLevel;
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue