create virtualisation component.
This commit is contained in:
parent
7e1e13e897
commit
29e3213e4b
14 changed files with 106 additions and 70 deletions
|
@ -10,6 +10,7 @@
|
|||
./nixos
|
||||
./terminal
|
||||
./timezone.nix
|
||||
./virtualisation
|
||||
./yubikey.nix
|
||||
];
|
||||
|
||||
|
|
|
@ -5,9 +5,11 @@ let
|
|||
|
||||
cfg = config.components.mainUser;
|
||||
|
||||
# todo : use optionalList
|
||||
dockerGroup =
|
||||
if (config.virtualisation.docker.enable) then [ "docker" ] else [ ];
|
||||
|
||||
# todo : use optionalList
|
||||
vboxGroup =
|
||||
if (config.virtualisation.virtualbox.host.enable) then
|
||||
[ "vboxusers" ]
|
||||
|
|
15
components/virtualisation/default.nix
Normal file
15
components/virtualisation/default.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
imports = [
|
||||
./docker.nix
|
||||
./podman.nix
|
||||
./virtualbox.nix
|
||||
./qemu.nix
|
||||
];
|
||||
|
||||
options.components.virtualisation.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
}
|
16
components/virtualisation/docker.nix
Normal file
16
components/virtualisation/docker.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
{
|
||||
|
||||
options.components.virtualisation.docker.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = config.components.virtualisation.enable;
|
||||
};
|
||||
|
||||
config = mkIf config.components.virtualisation.docker.enable {
|
||||
|
||||
virtualisation.docker.enable = true;
|
||||
|
||||
};
|
||||
|
||||
}
|
19
components/virtualisation/podman.nix
Normal file
19
components/virtualisation/podman.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
{
|
||||
|
||||
options.components.virtualisation.podman.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = config.components.virtualisation.enable;
|
||||
};
|
||||
|
||||
config = mkIf config.components.virtualisation.podman.enable {
|
||||
|
||||
virtualisation.podman.enable = true;
|
||||
|
||||
# make sure /var/lib/containers/storage is a zfs dataset
|
||||
virtualisation.podman.extraPackages = [ pkgs.zfs ];
|
||||
|
||||
};
|
||||
|
||||
}
|
27
components/virtualisation/qemu.nix
Normal file
27
components/virtualisation/qemu.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
{
|
||||
|
||||
options.components.virtualisation.qemu.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = config.components.virtualisation.enable;
|
||||
};
|
||||
|
||||
config = mkIf config.components.virtualisation.qemu.enable {
|
||||
|
||||
virtualisation.libvirtd.enable = true;
|
||||
#virtualisation.libvirtd.allowedBridges = ["virbr0"];
|
||||
virtualisation.libvirtd.onShutdown = "shutdown";
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.qemu_kvm
|
||||
#(pkgs.quickemu.override { qemu_full = pkgs.qemu_kvm; })
|
||||
pkgs.quickemu
|
||||
pkgs.virt-manager
|
||||
];
|
||||
|
||||
users.users.mainUser.extraGroups = [ "libvirtd" ];
|
||||
|
||||
};
|
||||
|
||||
}
|
21
components/virtualisation/virtualbox.nix
Normal file
21
components/virtualisation/virtualbox.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
{
|
||||
|
||||
options.components.virtualisation.virtualbox.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = config.components.virtualisation.enable;
|
||||
};
|
||||
|
||||
config = mkIf config.components.virtualisation.virtualbox.enable {
|
||||
|
||||
virtualisation.virtualbox = {
|
||||
host.enable = true;
|
||||
guest.enable = true;
|
||||
};
|
||||
|
||||
users.extraGroups.vboxusers.members = [ config.users.users.mainUser.name ];
|
||||
|
||||
};
|
||||
|
||||
}
|
|
@ -6,7 +6,6 @@
|
|||
./hardware-configuration
|
||||
|
||||
./syncthing.nix
|
||||
./qemu.nix
|
||||
|
||||
./network-tinc.nix
|
||||
./network-tinc_retiolum.nix
|
||||
|
@ -38,6 +37,8 @@
|
|||
# (promptKey "pushover.api_key");
|
||||
|
||||
|
||||
components.virtualisation.enable = true;
|
||||
|
||||
components.gui.enable = true;
|
||||
components.mainUser.enable = true;
|
||||
components.media.enable = true;
|
||||
|
@ -124,16 +125,6 @@
|
|||
|
||||
services.printing.enable = true;
|
||||
|
||||
virtualisation = {
|
||||
docker.enable = true;
|
||||
podman.enable = true;
|
||||
virtualbox = {
|
||||
host.enable = true;
|
||||
guest.enable = true;
|
||||
};
|
||||
};
|
||||
users.extraGroups.vboxusers.members = [ config.users.users.mainUser.name ];
|
||||
|
||||
# for congress and streaming
|
||||
hardware.graphics.enable = true;
|
||||
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
|
||||
virtualisation.libvirtd.enable = true;
|
||||
#virtualisation.libvirtd.allowedBridges = ["virbr0"];
|
||||
virtualisation.libvirtd.onShutdown = "shutdown";
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.qemu_kvm
|
||||
#(pkgs.quickemu.override { qemu_full = pkgs.qemu_kvm; })
|
||||
pkgs.quickemu
|
||||
pkgs.virt-manager
|
||||
];
|
||||
|
||||
users.users.mainUser.extraGroups = [ "libvirtd" ];
|
||||
|
||||
}
|
|
@ -66,7 +66,6 @@
|
|||
|
||||
services.printing.enable = false;
|
||||
|
||||
virtualisation.podman.extraPackages = [ pkgs.zfs ]; # make sure /var/lib/containers/storage is a zfs dataset
|
||||
|
||||
networking.hostName = "chungus";
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
./hardware-configuration.nix
|
||||
|
||||
./syncthing.nix
|
||||
./qemu.nix
|
||||
|
||||
./network-tinc.nix
|
||||
./network-tinc_retiolum.nix
|
||||
|
@ -22,6 +21,8 @@
|
|||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
boot.tmp.useTmpfs = true; # make /tmp a tmpfs (performance!)
|
||||
|
||||
components.virtualisation.enable = true;
|
||||
|
||||
components.gui.enable = true;
|
||||
components.gui.xorg.enable = true;
|
||||
components.gui.wayland.enable = false;
|
||||
|
@ -111,17 +112,6 @@
|
|||
|
||||
services.printing.enable = true;
|
||||
|
||||
virtualisation = {
|
||||
docker.enable = true;
|
||||
podman.enable = true;
|
||||
virtualbox = {
|
||||
host.enable = true;
|
||||
guest.enable = true;
|
||||
};
|
||||
};
|
||||
users.extraGroups.vboxusers.members = [ config.users.users.mainUser.name ];
|
||||
|
||||
|
||||
samba-share = {
|
||||
enable = false;
|
||||
folders = {
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
|
||||
virtualisation.libvirtd.enable = true;
|
||||
#virtualisation.libvirtd.allowedBridges = ["virbr0"];
|
||||
virtualisation.libvirtd.onShutdown = "shutdown";
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.qemu_kvm
|
||||
#(pkgs.quickemu.override { qemu_full = pkgs.qemu_kvm; })
|
||||
pkgs.quickemu
|
||||
pkgs.virt-manager
|
||||
];
|
||||
|
||||
users.users.mainUser.extraGroups = [ "libvirtd" ];
|
||||
|
||||
}
|
|
@ -3,10 +3,7 @@ let inherit (utils) escapeSystemdPath;
|
|||
in
|
||||
{
|
||||
|
||||
virtualisation = {
|
||||
# docker.enable = true;
|
||||
podman.enable = true;
|
||||
};
|
||||
virtualisation.podman.enable = true;
|
||||
|
||||
#nix.settings.trusted-users = [ "root" "gitea-runner"];
|
||||
nix.settings.allowed-users = [ "*" "gitea-runner" ];
|
||||
|
|
|
@ -84,13 +84,5 @@
|
|||
};
|
||||
};
|
||||
|
||||
virtualisation = {
|
||||
docker.enable = false;
|
||||
virtualbox = {
|
||||
host.enable = false;
|
||||
guest.enable = false;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue