Move vbox to Hosea

This commit is contained in:
Greg Hellings
2024-04-02 11:55:07 -05:00
parent 52c9502911
commit f1db2b7f6a
2 changed files with 59 additions and 54 deletions
+58 -1
View File
@@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{ config, pkgs, lib, inputs, overlays, ... }:
let
wanInterface = "enp2s0";
lanInterface = "enp1s0";
@@ -47,4 +47,61 @@ in
variant = "";
};
};
#####################################################################################
#################### Virtualbox Runner ##############################################
#####################################################################################
systemd.services."container@gitlab-runner-vbox" = {
# Moved here from myself/Isaiah, so technically unnecessary now
conflicts = [
"container@gitlab-runner-qemu.service"
];
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"
];
};
};
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
};
});
};
}
+1 -53
View File
@@ -39,6 +39,7 @@ in {
systemd.services = {
"container@gitlab-runner-qemu" = {
# Now moved to a separate machine
conflicts = [
"container@gitlab-runner-vbox.service"
];
@@ -51,20 +52,6 @@ in {
];
};
};
"container@gitlab-runner-vbox" = {
conflicts = [
"container@gitlab-runner-qemu.service"
];
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"
];
};
};
gitlab-runner.serviceConfig.EnvironmentFile = config.age.secrets.docker-auth.path;
};
@@ -101,45 +88,6 @@ in {
});
};
#####################################################################################
#################### Virtualbox Runner ##############################################
#####################################################################################
containers.gitlab-runner-vbox = container {
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 ./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
};
});
};
#####################################################################################
#################### Container Podman Runner ########################################
#####################################################################################