Run VBox on Hosea
This commit is contained in:
+68
-48
@@ -16,10 +16,18 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
# Bootloader.
|
# Bootloader
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot = {
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
loader = {
|
||||||
boot.loader.efi.efiSysMountPoint = "/boot/";
|
systemd-boot.enable = true;
|
||||||
|
efi = {
|
||||||
|
canTouchEfiVariables = true;
|
||||||
|
efiSysMountPoint = "/boot/";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
extraModprobeConfig = "vboxdrv";
|
||||||
|
};
|
||||||
|
users.users.greg.extraGroups = [ "vboxusers" ];
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "hosea";
|
hostName = "hosea";
|
||||||
@@ -46,62 +54,74 @@ in
|
|||||||
layout = "us";
|
layout = "us";
|
||||||
variant = "";
|
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 ##############################################
|
#################### 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
|
# Moved here from myself/Isaiah, so technically unnecessary now
|
||||||
conflicts = [
|
conflicts = [
|
||||||
"container@gitlab-runner-qemu.service"
|
"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 = {
|
serviceConfig = {
|
||||||
DevicePolicy = lib.mkForce "auto";
|
DevicePolicy = lib.mkForce "auto";
|
||||||
ExecStopPost = [ "${pkgs.kmod}/bin/rmmod vboxnetadp vboxnetflt vboxdrv" ];
|
User = "root";
|
||||||
ExecStartPre = [
|
DynamicUser = lib.mkForce false;
|
||||||
"${pkgs.kmod}/bin/modprobe vboxdrv"
|
|
||||||
"${pkgs.kmod}/bin/modprobe vboxnetadp"
|
|
||||||
"${pkgs.kmod}/bin/modprobe vboxnetflt"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
containers.gitlab-runner-vbox = {
|
networking.firewall.allowedTCPPorts = [ 18083 ]; # Should be interface for vboxweb
|
||||||
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
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,6 @@
|
|||||||
extraGroups = [
|
extraGroups = [
|
||||||
"kvm"
|
"kvm"
|
||||||
"sudo"
|
"sudo"
|
||||||
"vboxusers"
|
|
||||||
"wheel"
|
"wheel"
|
||||||
];
|
];
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
@@ -54,7 +53,7 @@
|
|||||||
};
|
};
|
||||||
system.stateVersion = lib.mkForce "24.05";
|
system.stateVersion = lib.mkForce "24.05";
|
||||||
boot = {
|
boot = {
|
||||||
extraModprobeConfig = "options kvm_amd nested=1 vboxdrv";
|
extraModprobeConfig = "options kvm_amd nested=1";
|
||||||
supportedFilesystems = [ "ntfs" ];
|
supportedFilesystems = [ "ntfs" ];
|
||||||
loader = {
|
loader = {
|
||||||
efi = {
|
efi = {
|
||||||
|
|||||||
@@ -147,6 +147,5 @@ in {
|
|||||||
virtualisation = {
|
virtualisation = {
|
||||||
docker.enable = true;
|
docker.enable = true;
|
||||||
oci-containers.backend = "docker";
|
oci-containers.backend = "docker";
|
||||||
virtualbox.host.enable = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ in
|
|||||||
"gitlab/myself-vbox-runner-reg.age".publicKeys = everyone;
|
"gitlab/myself-vbox-runner-reg.age".publicKeys = everyone;
|
||||||
"gitlab/myself-podman-runner-reg.age".publicKeys = everyone;
|
"gitlab/myself-podman-runner-reg.age".publicKeys = everyone;
|
||||||
"gitlab/myself-shell-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;
|
"gitlab/docker-auth.age".publicKeys = everyone;
|
||||||
|
|
||||||
"acme_password.age".publicKeys = everyone;
|
"acme_password.age".publicKeys = everyone;
|
||||||
|
|||||||
Reference in New Issue
Block a user