feat: enable KVM on Linux if available

This commit is contained in:
Sander 2023-11-22 14:53:08 +00:00
parent a56e3a8089
commit fe19c91c6b
No known key found for this signature in database
GPG key ID: D1A763BC84F34603
3 changed files with 18 additions and 0 deletions

View file

@ -6,6 +6,17 @@ if nix_path="$(type -p nix)" ; then
exit
fi
if [[ ($OSTYPE =~ linux) && ($INPUT_ENABLE_KVM == 'true') ]]; then
enable_kvm() {
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-install-nix-action-kvm.rules
sudo udevadm control --reload-rules && sudo udevadm trigger --name-match=kvm
}
echo '::group::Enabling KVM support'
enable_kvm && echo 'Enabled KVM' || echo 'KVM is not available'
echo '::endgroup::'
fi
# GitHub command to put the following log messages into a group which is collapsed by default
echo "::group::Installing Nix"