Added libvirt-qemu module.
This commit is contained in:
parent
86aded238d
commit
6fe7b1e982
4 changed files with 82 additions and 4 deletions
39
flake.lock
39
flake.lock
|
@ -374,6 +374,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs-ovmf": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1708984720,
|
||||||
|
"narHash": "sha256-gJctErLbXx4QZBBbGp78PxtOOzsDaQ+yw1ylNQBuSUY=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "13aff9b34cc32e59d35c62ac9356e4a41198a538",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs-stable": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720282526,
|
"lastModified": 1720282526,
|
||||||
|
@ -406,6 +422,28 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixvirt-git": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nixpkgs-ovmf": "nixpkgs-ovmf"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1712439808,
|
||||||
|
"narHash": "sha256-QoONoZPBpNTw5cia05QSvDlaxXo3moKAJQOw7c5hMXA=",
|
||||||
|
"owner": "AshleyYakeley",
|
||||||
|
"repo": "NixVirt",
|
||||||
|
"rev": "9f1cdca730d92461075709e867c1e9ad93d58a8d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "AshleyYakeley",
|
||||||
|
"ref": "v0.5.0",
|
||||||
|
"repo": "NixVirt",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nur": {
|
"nur": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720478695,
|
"lastModified": 1720478695,
|
||||||
|
@ -517,6 +555,7 @@
|
||||||
"nixos-hardware": "nixos-hardware",
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
|
"nixvirt-git": "nixvirt-git",
|
||||||
"nur": "nur",
|
"nur": "nur",
|
||||||
"sops-nix": "sops-nix",
|
"sops-nix": "sops-nix",
|
||||||
"talhelper": "talhelper"
|
"talhelper": "talhelper"
|
||||||
|
|
18
flake.nix
18
flake.nix
|
@ -23,7 +23,7 @@
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
# home-manager - unstable
|
# home-manager - Manage user configuration with nix
|
||||||
# https://github.com/nix-community/home-manager
|
# https://github.com/nix-community/home-manager
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager/release-24.05";
|
url = "github:nix-community/home-manager/release-24.05";
|
||||||
|
@ -64,10 +64,20 @@
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Lix- Substitution of the Nix package manager, focused on correctness, usability, and growth – and committed to doing right by its community.
|
||||||
|
# https://git.lix.systems/lix-project/lix
|
||||||
lix-module = {
|
lix-module = {
|
||||||
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.90.0.tar.gz";
|
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.90.0.tar.gz";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# NixVirt for qemu & libvirt
|
||||||
|
# https://github.com/AshleyYakeley/NixVirt
|
||||||
|
nixvirt-git = {
|
||||||
|
url = "github:AshleyYakeley/NixVirt/v0.5.0";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
|
@ -98,7 +108,7 @@
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
# Import overlays for building nixosconfig with them.
|
# Import overlays for building nixosconfig with them.
|
||||||
overlays = import ./nixos/overlays { inherit inputs; };
|
overlays = import ./nixos/overlays { inherit inputs; };
|
||||||
# generate a base nixos configuration with the specified overlays, hardware modules, and any extraModules applied
|
# generate a base nixos configuration with the specified overlays, hardware modules, and any AerModules applied
|
||||||
mkNixosConfig =
|
mkNixosConfig =
|
||||||
{ hostname
|
{ hostname
|
||||||
, system ? "x86_64-linux"
|
, system ? "x86_64-linux"
|
||||||
|
@ -229,13 +239,13 @@
|
||||||
"gandalf" = mkNixosConfig {
|
"gandalf" = mkNixosConfig {
|
||||||
# X9DRi-LN4+/X9DR3-LN4+ - Intel(R) Xeon(R) CPU E5-2650 v2
|
# X9DRi-LN4+/X9DR3-LN4+ - Intel(R) Xeon(R) CPU E5-2650 v2
|
||||||
# NAS
|
# NAS
|
||||||
hostname = "telperion";
|
hostname = "gandalf";
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
hardwareModules = [
|
hardwareModules = [
|
||||||
|
lix-module.nixosModules.default
|
||||||
./nixos/profiles/hw-supermicro.nix
|
./nixos/profiles/hw-supermicro.nix
|
||||||
disko.nixosModules.disko
|
disko.nixosModules.disko
|
||||||
(import ./nixos/profiles/disko-nixos.nix { disks = [ "/dev/sda/dev/disk/by-id/ata-Seagate_IronWolfPro_ZA240NX10001-2ZH100_7TF002RA" ]; })
|
(import ./nixos/profiles/disko-nixos.nix { disks = [ "/dev/sda/dev/disk/by-id/ata-Seagate_IronWolfPro_ZA240NX10001-2ZH100_7TF002RA" ]; })
|
||||||
lix-module.nixosModules.default
|
|
||||||
];
|
];
|
||||||
profileModules = [
|
profileModules = [
|
||||||
./nixos/profiles/role-server.nix
|
./nixos/profiles/role-server.nix
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
./cockpit
|
./cockpit
|
||||||
./forgejo
|
./forgejo
|
||||||
./haproxy
|
./haproxy
|
||||||
|
./libvirt-qemu
|
||||||
./nginx
|
./nginx
|
||||||
./onepassword-connect
|
./onepassword-connect
|
||||||
./podman
|
./podman
|
||||||
|
|
28
nixos/modules/nixos/services/libvirt-qemu/default.nix
Normal file
28
nixos/modules/nixos/services/libvirt-qemu/default.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{ lib, config, pkgs, inputs, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.mySystem.services.libvirt-qemu;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ inputs.nixvirt-git.nixosModules.default ];
|
||||||
|
options.mySystem.services.libvirt-qemu = {
|
||||||
|
enable = mkEnableOption "libvirt-qemu";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
networking.firewall = {
|
||||||
|
allowedTCPPorts = [ 16509 16514 ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable bind with domain configuration
|
||||||
|
virtualisation.libvirt.enable = true;
|
||||||
|
virtualisation.libvirtd = {
|
||||||
|
enable = true;
|
||||||
|
qemu = {
|
||||||
|
package = pkgs.qemu_kvm;
|
||||||
|
ovmf.enable = true;
|
||||||
|
ovmf.packages = [ pkgs.OVMFFull.fd ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue