From 959bf8253cc7793a6efbc6dec2d513a035986c76 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sat, 15 Jul 2023 22:54:03 +0100 Subject: [PATCH] Add oracle cloud based ARM runner for forge --- krops/krops.nix | 34 ++++-------- krops/oracle-gitea-runner/configuration.nix | 58 +++++++++++++++++++++ krops/oracle-gitea-runner/hardware.nix | 15 ++++++ 3 files changed, 82 insertions(+), 25 deletions(-) create mode 100644 krops/oracle-gitea-runner/configuration.nix create mode 100644 krops/oracle-gitea-runner/hardware.nix diff --git a/krops/krops.nix b/krops/krops.nix index 78f83be..c93e683 100644 --- a/krops/krops.nix +++ b/krops/krops.nix @@ -5,28 +5,16 @@ let lib = import "${krops}/lib"; pkgs = import "${krops}/pkgs" {}; - dev-vm-source = lib.evalSource [ + oracle-gitea-runner-source = lib.evalSource [ { nixpkgs.git = { - ref = "origin/nixos-22.11"; + ref = "0a4f20e1867ebb798ba5ed51b9db52a09ba6623d"; url = https://github.com/NixOS/nixpkgs; + + shallow = true; }; - nixos-config.file = toString ./dev-vm/configuration.nix; - hardware.file = toString ./dev-vm/hardware.nix; - } - ]; - ipad-dev-source = lib.evalSource [ - { - nixpkgs.git = { - ref = "origin/nixos-22.11"; - url = https://github.com/NixOS/nixpkgs; - }; - home-manager.git = { - ref = "origin/release-22.11"; - url = https://github.com/nix-community/home-manager; - }; - nixos-config.file = toString ./ipad-dev/configuration.nix; - "hardware.nix".file = toString ./ipad-dev/hardware.nix; + nixos-config.file = toString ./oracle-gitea-runner/configuration.nix; + "hardware.nix".file = toString ./oracle-gitea-runner/hardware.nix; } ]; @@ -69,13 +57,9 @@ let ]; in { - dev-vm = pkgs.krops.writeDeploy "dev-vm" { - source = dev-vm-source; - target = "root@192.168.50.126"; - }; - ipad-dev = pkgs.krops.writeDeploy "ipad-dev" { - source = ipad-dev-source; - target = "root@143.47.234.244"; + oracle-gitea-runner = pkgs.krops.writeDeploy "oracle-gitea-runner" { + source = oracle-gitea-runner-source; + target = "root@130.162.169.74"; }; nas = pkgs.krops.writeDeploy "nas" { source = nas-source; diff --git a/krops/oracle-gitea-runner/configuration.nix b/krops/oracle-gitea-runner/configuration.nix new file mode 100644 index 0000000..0fe6605 --- /dev/null +++ b/krops/oracle-gitea-runner/configuration.nix @@ -0,0 +1,58 @@ +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware.nix + ]; + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + boot.tmp.cleanOnBoot = true; + zramSwap.enable = true; + networking.hostName = "gitea-arm-runner"; + networking.domain = "gmem.ca"; + environment.systemPackages = with pkgs; [ + vim + wget + git + htop + tailscale + ]; + + services.gitea-actions-runner = { + instances = { + oracle-arm = { + name = "oracle-arm"; + enable = true; + labels = [ + "debian-latest-arm:docker://node:18-bullseye" + "arm:host" + ]; + url = "https://vancouver.scorpion-ghost.ts.net/git"; + token = ""; + }; + }; + }; + + programs.zsh.enable = true; + programs.fish.enable = true; + environment.shells = with pkgs; [ zsh fish ]; + + users.users = { + root.openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILIztwQxt+jqroFONSgq+xzPMuE2I5Dq/zWPQ8RcTYJr" + ]; + }; + virtualisation = { + docker = { + enable = true; + rootless = { + enable = true; + setSocketVariable = true; + }; + }; + }; + + services.openssh.enable = true; + services.tailscale.enable = true; + system.stateVersion = "23.05"; +} diff --git a/krops/oracle-gitea-runner/hardware.nix b/krops/oracle-gitea-runner/hardware.nix new file mode 100644 index 0000000..ccd5d2d --- /dev/null +++ b/krops/oracle-gitea-runner/hardware.nix @@ -0,0 +1,15 @@ +{ modulesPath, ... }: +{ + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; + boot.loader.efi.efiSysMountPoint = "/boot/efi"; + boot.loader.grub = { + efiSupport = true; + efiInstallAsRemovable = true; + device = "nodev"; + }; + fileSystems."/boot/efi" = { device = "/dev/disk/by-uuid/CC2E-AEC0"; fsType = "vfat"; }; + boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" ]; + boot.initrd.kernelModules = [ "nvme" ]; + fileSystems."/" = { device = "/dev/mapper/ocivolume-root"; fsType = "xfs"; }; + +}