changes
This commit is contained in:
parent
916f497b84
commit
7aed32eea7
15 changed files with 210 additions and 154 deletions
|
|
@ -106,6 +106,26 @@ with lib.custom; let
|
|||
# Change to powersave governor
|
||||
echo powersave | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||||
'';
|
||||
|
||||
libvirtd-cfg = config.virtualisation.libvirtd;
|
||||
|
||||
qemuConfigFile = pkgs.writeText "qemu.conf" ''
|
||||
${optionalString libvirtd-cfg.qemu.ovmf.enable ''
|
||||
nvram = [
|
||||
"/run/libvirt/nix-ovmf/AAVMF_CODE.fd:/run/libvirt/nix-ovmf/AAVMF_VARS.fd",
|
||||
"/run/libvirt/nix-ovmf/AAVMF_CODE.ms.fd:/run/libvirt/nix-ovmf/AAVMF_VARS.ms.fd",
|
||||
"/run/libvirt/nix-ovmf/OVMF_CODE.fd:/run/libvirt/nix-ovmf/OVMF_VARS.fd",
|
||||
"/run/libvirt/nix-ovmf/OVMF_CODE.ms.fd:/run/libvirt/nix-ovmf/OVMF_VARS.ms.fd"
|
||||
]
|
||||
''}
|
||||
${optionalString (!libvirtd-cfg.qemu.runAsRoot) ''
|
||||
user = "qemu-libvirtd"
|
||||
group = "qemu-libvirtd"
|
||||
''}
|
||||
${libvirtd-cfg.qemu.verbatimConfig}
|
||||
'';
|
||||
|
||||
dirName = "libvirt";
|
||||
in {
|
||||
options.hardware.gpu-passthru = with types; {
|
||||
enable = mkBoolOpt false "Enable support for single gpu-passthru";
|
||||
|
|
@ -173,9 +193,45 @@ in {
|
|||
in [env];
|
||||
};
|
||||
|
||||
systemd.services.libvirtd-config = {
|
||||
enable = lib.mkForce false;
|
||||
};
|
||||
systemd.services.libvirtd-config.script = lib.mkForce ''
|
||||
# Copy default libvirt network config .xml files to /var/lib
|
||||
# Files modified by the user will not be overwritten
|
||||
for i in $(cd ${libvirtd-cfg.package}/var/lib && echo \
|
||||
libvirt/qemu/networks/*.xml \
|
||||
libvirt/nwfilter/*.xml );
|
||||
do
|
||||
# Intended behavior
|
||||
# shellcheck disable=SC2174
|
||||
mkdir -p "/var/lib/$(dirname "$i")" -m 755
|
||||
if [ ! -e "/var/lib/$i" ]; then
|
||||
cp -pd "${libvirtd-cfg.package}/var/lib/$i" "/var/lib/$i"
|
||||
fi
|
||||
done
|
||||
|
||||
# Copy generated qemu config to libvirt directory
|
||||
cp -f ${qemuConfigFile} /var/lib/${dirName}/qemu.conf
|
||||
|
||||
# stable (not GC'able as in /nix/store) paths for using in <emulator> section of xml configs
|
||||
for emulator in ${libvirtd-cfg.package}/libexec/libvirt_lxc ${libvirtd-cfg.qemu.package}/bin/qemu-kvm ${libvirtd-cfg.qemu.package}/bin/qemu-system-*; do
|
||||
ln -s --force "$emulator" /run/${dirName}/nix-emulators/
|
||||
done
|
||||
|
||||
ln -s --force ${libvirtd-cfg.qemu.package}/bin/qemu-pr-helper /run/${dirName}/nix-helpers/
|
||||
|
||||
${optionalString libvirtd-cfg.qemu.ovmf.enable (
|
||||
let
|
||||
ovmfpackage = pkgs.buildEnv {
|
||||
name = "qemu-ovmf";
|
||||
paths = libvirtd-cfg.qemu.ovmf.packages;
|
||||
};
|
||||
in ''
|
||||
ln -s --force ${ovmfpackage}/FV/AAVMF_CODE{,.ms}.fd /run/${dirName}/nix-ovmf/
|
||||
ln -s --force ${ovmfpackage}/FV/OVMF_CODE{,.ms}.fd /run/${dirName}/nix-ovmf/
|
||||
ln -s --force ${ovmfpackage}/FV/AAVMF_VARS{,.ms}.fd /run/${dirName}/nix-ovmf/
|
||||
ln -s --force ${ovmfpackage}/FV/OVMF_VARS{,.ms}.fd /run/${dirName}/nix-ovmf/
|
||||
''
|
||||
)}
|
||||
'';
|
||||
|
||||
system.activationScripts.libvirt-hooks.text = ''
|
||||
ln -Tfs /etc/libvirt/hooks /var/lib/libvirt/hooks
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ in {
|
|||
hydraURL = "https://hydra.zoeys.computer";
|
||||
useSubstitutes = true;
|
||||
notificationSender = "hydra@localhost"; # e-mail of hydra service
|
||||
extraConfig = ''
|
||||
Include /var/lib/hydra/github_authorizations.conf
|
||||
'';
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."hydra.zoeys.computer" = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue