diff --git a/hosts/hosea/default.nix b/hosts/hosea/default.nix index faa014c..9795fa0 100644 --- a/hosts/hosea/default.nix +++ b/hosts/hosea/default.nix @@ -16,10 +16,18 @@ in ]; - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.efi.efiSysMountPoint = "/boot/"; + # Bootloader + boot = { + loader = { + systemd-boot.enable = true; + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot/"; + }; + }; + extraModprobeConfig = "vboxdrv"; + }; + users.users.greg.extraGroups = [ "vboxusers" ]; networking = { hostName = "hosea"; @@ -46,62 +54,74 @@ in layout = "us"; variant = ""; }; + gitlab-runner = { + enable = true; + settings.concurrent = 5; + services = { + shell = { + executor = "shell"; + limit = 5; + registrationConfigFile = config.age.secrets.runner-reg.path; + environmentVariables = { + EFI_DIR = "${pkgs.OVMF.fd}/FV/"; + }; + }; + }; + }; }; ##################################################################################### #################### Virtualbox Runner ############################################## ##################################################################################### - systemd.services."container@gitlab-runner-vbox" = { + age.secrets.runner-reg.file = ../../secrets/gitlab/myself-vbox-runner-reg.age; + virtualisation.virtualbox.host = { + enable = true; + enableExtensionPack = true; + enableHardening = false; + headless = true; + }; + + systemd.services."gitlab-runner" = { + after = [ + "network.target" + "network-online.target" + "systemd-resolved.service" + ]; # Moved here from myself/Isaiah, so technically unnecessary now conflicts = [ "container@gitlab-runner-qemu.service" ]; + wants = [ + "network-online.target" + "systemd-resolved.service" + ]; + path = with pkgs; [ + curl + gawk + git + p7zip + packer + pup + gregpy + shellcheck + unzip + xonsh + xorriso + vagrant + wget + ]; + preStart = builtins.concatStringsSep "\n" [ + "${pkgs.kmod}/bin/modprobe vboxdrv" + "${pkgs.kmod}/bin/modprobe vboxnetadp" + "${pkgs.kmod}/bin/modprobe vboxnetflt" + ]; + postStop = "${pkgs.kmod}/bin/rmmod vboxnetadp vboxnetflt vboxdrv"; serviceConfig = { DevicePolicy = lib.mkForce "auto"; - ExecStopPost = [ "${pkgs.kmod}/bin/rmmod vboxnetadp vboxnetflt vboxdrv" ]; - ExecStartPre = [ - "${pkgs.kmod}/bin/modprobe vboxdrv" - "${pkgs.kmod}/bin/modprobe vboxnetadp" - "${pkgs.kmod}/bin/modprobe vboxnetflt" - ]; + User = "root"; + DynamicUser = lib.mkForce false; }; }; - containers.gitlab-runner-vbox = { - bindMounts."/etc/ssh/ssh_host_ed25519_key".hostPath = "/etc/ssh/ssh_host_ed25519_key"; # For agenix secrets - privateNetwork = true; - bindMounts = { - "/dev/vboxdrv" = { - hostPath = "/dev/vboxdrv"; - isReadOnly = false; - }; - "/dev/vboxdrvu" = { - hostPath = "/dev/vboxdrvu"; - isReadOnly = false; - }; - "/dev/vboxnetctl" = { - hostPath = "/dev/vboxnetctl"; - isReadOnly = false; - }; - }; - hostAddress = "192.168.202.1"; - localAddress = "192.168.202.2"; - config = ((import ../myself/container-runner.nix) { - inherit inputs overlays; - name = "vbox"; - extra = { - systemd.services.gitlab-runner.serviceConfig = { - User = "root"; - DynamicUser = lib.mkForce false; - }; - virtualisation.virtualbox.host = { - enable = true; - enableExtensionPack = true; - enableHardening = false; - headless = true; - }; - networking.firewall.allowedTCPPorts = [ 18083 ]; # Should be interface for vboxweb - }; - }); - }; + networking.firewall.allowedTCPPorts = [ 18083 ]; # Should be interface for vboxweb } diff --git a/hosts/myself/default.nix b/hosts/myself/default.nix index 1f848bf..113ec8b 100644 --- a/hosts/myself/default.nix +++ b/hosts/myself/default.nix @@ -45,7 +45,6 @@ extraGroups = [ "kvm" "sudo" - "vboxusers" "wheel" ]; isNormalUser = true; @@ -54,7 +53,7 @@ }; system.stateVersion = lib.mkForce "24.05"; boot = { - extraModprobeConfig = "options kvm_amd nested=1 vboxdrv"; + extraModprobeConfig = "options kvm_amd nested=1"; supportedFilesystems = [ "ntfs" ]; loader = { efi = { diff --git a/hosts/myself/git.nix b/hosts/myself/git.nix index ee6b52d..bd76679 100644 --- a/hosts/myself/git.nix +++ b/hosts/myself/git.nix @@ -147,6 +147,5 @@ in { virtualisation = { docker.enable = true; oci-containers.backend = "docker"; - virtualbox.host.enable = true; }; } diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 15b142b..fc29e62 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -57,7 +57,6 @@ in "gitlab/myself-vbox-runner-reg.age".publicKeys = everyone; "gitlab/myself-podman-runner-reg.age".publicKeys = everyone; "gitlab/myself-shell-runner-reg.age".publicKeys = everyone; - "gitlab/myself-vmware-runner-reg.age".publicKeys = everyone; "gitlab/docker-auth.age".publicKeys = everyone; "acme_password.age".publicKeys = everyone;