Reinstall magnesium
This commit is contained in:
parent
464a1847a6
commit
dcb50b0970
9 changed files with 194 additions and 120 deletions
108
modules/providers/hetzner-cloud.nix
Normal file
108
modules/providers/hetzner-cloud.nix
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
{ config
|
||||
, pkgs
|
||||
, modulesPath
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
cfg = config.disko;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
config = {
|
||||
networking.useDHCP = false;
|
||||
|
||||
systemd.network = {
|
||||
enable = true;
|
||||
networks."10-wan" = {
|
||||
matchConfig.Name = "enp1s0";
|
||||
networkConfig.DHCP = "ipv4";
|
||||
routes = [
|
||||
{ Gateway = "fe80::1"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
boot = {
|
||||
loader = {
|
||||
grub.enable = pkgs.hostPlatform.system == "x86_64-linux";
|
||||
systemd-boot = {
|
||||
enable = pkgs.hostPlatform.system == "aarch64-linux";
|
||||
configurationLimit = 10;
|
||||
};
|
||||
efi = {
|
||||
efiSysMountPoint = "/boot";
|
||||
canTouchEfiVariables = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
disko.devices = {
|
||||
disk = {
|
||||
virt = {
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
size = "1M";
|
||||
type = "EF02"; # for grub MBR
|
||||
priority = 1; # Needs to be first partition
|
||||
};
|
||||
esp = {
|
||||
type = "EF00";
|
||||
size = "1024M";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "uid=0" "gid=0" "fmask=0077" "dmask=0077" "nodev" "nosuid" "noexec" ];
|
||||
};
|
||||
};
|
||||
linux = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ];
|
||||
postCreateHook =
|
||||
let
|
||||
device = cfg.devices.disk.virt.content.partitions.linux.device;
|
||||
in
|
||||
''
|
||||
mountpoint="$(mktemp -d)"
|
||||
mount "${device}" "$mountpoint" -o subvol=/
|
||||
trap 'umount "$mountpoint"; rmdir "$mountpoint"' EXIT
|
||||
btrfs subvolume snapshot -r $mountpoint/root $mountpoint/root-blank
|
||||
'';
|
||||
subvolumes = {
|
||||
"/root" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [ "compress-force=zstd:1" "noatime" ];
|
||||
};
|
||||
"/home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = [ "compress-force=zstd:1" "noatime" "nodev" "nosuid" ];
|
||||
};
|
||||
"/nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [ "compress-force=zstd:1" "noatime" "nodev" ];
|
||||
};
|
||||
"/log" = {
|
||||
mountpoint = "/var/log";
|
||||
mountOptions = [ "compress-force=zstd:1" "noatime" "nodev" "nosuid" ];
|
||||
};
|
||||
"/persist" = {
|
||||
mountpoint = "/persist";
|
||||
mountOptions = [ "compress-force=zstd:1" "noatime" "nodev" "nosuid" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue