I am batman
This commit is contained in:
21
modules/virtualization/blackarch.nix
Normal file
21
modules/virtualization/blackarch.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
blackarchISO = "https://blackarch.org/blackarch-linux-live-2023.12.01-x86_64.iso"; # Change URL if outdated
|
||||
vmStorage = "/var/lib/libvirt/images/blackarch.qcow2"; # Change this path if needed
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "blackarch-vm";
|
||||
buildInputs = [ pkgs.qemu ];
|
||||
|
||||
unpackPhase = "true"; # No unpacking needed
|
||||
|
||||
installPhase = ''
|
||||
echo "Creating BlackArch VM disk..."
|
||||
qemu-img create -f qcow2 ${vmStorage} 50G
|
||||
echo "BlackArch VM disk created at ${vmStorage}"
|
||||
'';
|
||||
|
||||
meta.description = "BlackArch Linux VM installation";
|
||||
}
|
||||
|
||||
6
modules/virtualization/default.nix
Normal file
6
modules/virtualization/default.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
imports = [
|
||||
./vm.nix
|
||||
./blackarch.nix
|
||||
];
|
||||
}
|
||||
37
modules/virtualization/vm.nix
Normal file
37
modules/virtualization/vm.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
qemu
|
||||
libvirt
|
||||
uefi-run
|
||||
lxc
|
||||
swtpm
|
||||
bottles
|
||||
dosfstools
|
||||
virt-manager
|
||||
virt-viewer
|
||||
dnsmasq
|
||||
bridge-utils
|
||||
ebtables
|
||||
iptables
|
||||
];
|
||||
|
||||
virtualisation = {
|
||||
libvirtd = {
|
||||
enable = true;
|
||||
qemu.runAsRoot = false;
|
||||
};
|
||||
};
|
||||
|
||||
users.groups.libvirtd.members = [ "cody" ]; # Replace "cody" with your username
|
||||
|
||||
systemd.services.libvirtd.wantedBy = [ "multi-user.target" ];
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 5900 ]; # VNC for VM access
|
||||
|
||||
services.udev.packages = [ pkgs.qemu_kvm ];
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user