From f7b233c14ff5cddba214f19211d980bc21b5c5c8 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 11 Mar 2022 00:18:19 +0100 Subject: ma gum.r: arise --- makefu/1systems/gum/config.nix | 7 ++-- makefu/1systems/gum/hetznercloud/default.nix | 50 ++++++++++++++++++++++++++++ makefu/1systems/gum/hetznercloud/doit | 13 ++++++++ makefu/1systems/gum/hetznercloud/network.nix | 35 +++++++++++++++++++ makefu/1systems/gum/hetznercloud/sfdisk.part | 6 ++++ 5 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 makefu/1systems/gum/hetznercloud/default.nix create mode 100644 makefu/1systems/gum/hetznercloud/doit create mode 100644 makefu/1systems/gum/hetznercloud/network.nix create mode 100644 makefu/1systems/gum/hetznercloud/sfdisk.part (limited to 'makefu/1systems/gum') diff --git a/makefu/1systems/gum/config.nix b/makefu/1systems/gum/config.nix index 089fc8e9f..540106004 100644 --- a/makefu/1systems/gum/config.nix +++ b/makefu/1systems/gum/config.nix @@ -8,7 +8,7 @@ let in { imports = [ - ./hardware-config.nix + ./hetznercloud { users.users.lass = { uid = 19002; @@ -42,7 +42,7 @@ in { - + # @@ -109,7 +109,6 @@ in { # samba sahre # - { nixpkgs.config.allowUnfree = true; } # @@ -189,7 +188,7 @@ in { ]; # makefu.dl-dir = "/var/download"; - makefu.dl-dir = "/media/cloud/download"; + makefu.dl-dir = "/media/cloud/download/finished"; services.openssh.hostKeys = lib.mkForce [ { bits = 4096; path = (toString ); type = "rsa"; } diff --git a/makefu/1systems/gum/hetznercloud/default.nix b/makefu/1systems/gum/hetznercloud/default.nix new file mode 100644 index 000000000..cfcd894af --- /dev/null +++ b/makefu/1systems/gum/hetznercloud/default.nix @@ -0,0 +1,50 @@ +{ config, lib, pkgs, modulesPath, ... }: +{ + + imports = + [ ./network.nix + (modulesPath + "/profiles/qemu-guest.nix") + ]; + + # Disk + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "rpool/root"; + fsType = "zfs"; + }; + + fileSystems."/home" = + { device = "rpool/home"; + fsType = "zfs"; + }; + + fileSystems."/nix" = + { device = "rpool/nix"; + fsType = "zfs"; + }; + + fileSystems."/boot" = + { device = "/dev/sda1"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + boot.loader.grub.device = "/dev/sda"; + + networking.hostId = "3150697b"; # required for zfs use + boot.tmpOnTmpfs = true; + boot.supportedFilesystems = [ "zfs" ]; + + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.copyKernels = true; + boot.zfs.devNodes = "/dev"; # fixes some virtualmachine issues + boot.kernelParams = [ + "boot.shell_on_fail" + "panic=30" "boot.panic_on_fail" # reboot the machine upon fatal boot issues + ]; +} diff --git a/makefu/1systems/gum/hetznercloud/doit b/makefu/1systems/gum/hetznercloud/doit new file mode 100644 index 000000000..45798587a --- /dev/null +++ b/makefu/1systems/gum/hetznercloud/doit @@ -0,0 +1,13 @@ +ROOT_DEVICE=/dev/sda2 +NIXOS_BOOT=/dev/sda1 + +zpool create -o ashift=12 -o altroot=/mnt rpool $ROOT_DEVICE +zfs create -o mountpoint=legacy rpool/root +zfs create -o mountpoint=legacy rpool/home +zfs create -o mountpoint=legacy rpool/nix +mount -t zfs rpool/root /mnt +mkdir /mnt/{home,nix,boot} +mount -t zfs rpool/home /mnt/home +mount -t zfs rpool/nix /mnt/nix +mount $NIXOS_BOOT /mnt/boot/ + diff --git a/makefu/1systems/gum/hetznercloud/network.nix b/makefu/1systems/gum/hetznercloud/network.nix new file mode 100644 index 000000000..24fe3842f --- /dev/null +++ b/makefu/1systems/gum/hetznercloud/network.nix @@ -0,0 +1,35 @@ +{ config, lib, pkgs, modulesPath, ... }: +let + external-mac = "96:00:01:24:33:f4"; + external-gw = "172.31.1.1"; + external-ip = "142.132.189.140"; + external-ip6 = "2a01:4f8:1c17:5cdf::2/64"; + external-gw6 = "fe80::1"; + external-netmask = 32; + external-netmask6 = 64; + internal-ip = config.krebs.build.host.nets.retiolum.ip4.addr; + ext-if = "et0"; # gets renamed on the fly +in +{ + makefu.server.primary-itf = ext-if; + services.udev.extraRules = '' + SUBSYSTEM=="net", ATTR{address}=="${external-mac}", NAME="${ext-if}" + ''; + networking = { + interfaces."${ext-if}" = { + useDHCP = true; + }; + #ipv4.addresses = [{ + # address = external-ip; + # prefixLength = external-netmask; + #}]; + #ipv6.addresses = [{ + # address = external-ip6; + # prefixLength = external-netmask6; + # }]; + #}; + #defaultGateway6 = { address = external-gw6; interface = ext-if; }; + #defaultGateway = external-gw; + nameservers = [ "1.1.1.1" ]; + }; +} diff --git a/makefu/1systems/gum/hetznercloud/sfdisk.part b/makefu/1systems/gum/hetznercloud/sfdisk.part new file mode 100644 index 000000000..fb375b15a --- /dev/null +++ b/makefu/1systems/gum/hetznercloud/sfdisk.part @@ -0,0 +1,6 @@ +label: gpt +device: /dev/sda +unit: sectors +1 : size=524288 type=0FC63DAF-8483-4772-8E79-3D69D8477DE4 +4 : size=4096 type=21686148-6449-6E6F-744E-656564454649 +2 : type=0FC63DAF-8483-4772-8E79-3D69D8477DE4 -- cgit v1.2.3