nixos-config/sets/virtualization.nix
Artemis Tosini f16a637f1f
flake.lock: Update
Flake lock file updates:

• Updated input 'darwin':
    'github:lnl7/nix-darwin/7e08a9dd34314fb8051c28b231a68726c54daa7b' (2024-07-31)
  → 'github:lnl7/nix-darwin/f7142b8024d6b70c66fd646e1d099d3aa5bfec49' (2024-08-02)
• Updated input 'home-manager':
    'github:nix-community/home-manager/58cef3796271aaeabaed98884d4abaab5d9d162d' (2024-07-31)
  → 'github:nix-community/home-manager/afc892db74d65042031a093adb6010c4c3378422' (2024-08-02)
• Updated input 'jovian':
    'github:jovian-experiments/jovian-nixos/3bd059992912139d6a12e86ba418f933ec368ef2' (2024-07-26)
  → 'github:jovian-experiments/jovian-nixos/bcfe9dc708c92590fec676692b3ed79443eda819' (2024-08-03)
• Updated input 'lix':
    'c347d3df8f.tar.gz?narHash=sha256-RFyGpPsBSO9Jkt2zD7wmN89LTeJ5AaazCK7L6VGOtAw%3D' (2024-07-30)
  → '66469fc281.tar.gz?narHash=sha256-FrM0DN/i5kKB06/4KYNkY3mMGpC5hYQhaKtx1mneReU%3D' (2024-08-03)
• Updated input 'lix-module':
    '550352df73.tar.gz?narHash=sha256-w8C3AWOyasmmIuVSH8YgmpersZ89RIwbDs%2BvctK9CPg%3D' (2024-07-30)
  → 'e350380d72.tar.gz?narHash=sha256-%2B7RReWaFQUO8MfAhJYNm4FkALuM3rPGy2AlXXv9Jmc8%3D' (2024-08-01)
• Updated input 'nix-index-database':
    'github:nix-community/nix-index-database/c0ca47e8523b578464014961059999d8eddd4aae' (2024-07-28)
  → 'github:nix-community/nix-index-database/97ca0a0fca0391de835f57e44f369a283e37890f' (2024-08-04)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/2c9d7098712acf913c4d3f46f80ecbd7a38097f4' (2024-07-31)
  → 'github:nixos/nixpkgs/41d21a82c38e226e234e16f4ff213b3fcf85e6e9' (2024-08-05)
• Updated input 'nixvim':
    'github:nix-community/nixvim/8945b3b5e336a42972448e2f07ed5bc465a40c83' (2024-07-31)
  → 'github:nix-community/nixvim/5922a48008e5759acb63a12b2de8348ec512760f' (2024-08-05)
• Updated input 'nixvim/flake-parts':
    'github:hercules-ci/flake-parts/9227223f6d922fee3c7b190b2cc238a99527bbb7' (2024-07-03)
  → 'github:hercules-ci/flake-parts/8471fe90ad337a8074e957b69ca4d0089218391d' (2024-08-01)
• Updated input 'nixvim/nuschtosSearch':
    'github:NuschtOS/search/16565307c267ec219c2b5d3494ba66df08e7d403' (2024-07-28)
  → 'github:NuschtOS/search/3f5abffa5f28b4ac3c9212c81c5e8d2d22876071' (2024-08-01)
• Updated input 'nixvim/treefmt-nix':
    'github:numtide/treefmt-nix/8db8970be1fb8be9c845af7ebec53b699fe7e009' (2024-07-23)
  → 'github:numtide/treefmt-nix/768acdb06968e53aa1ee8de207fd955335c754b7' (2024-07-30)
2024-08-05 19:52:42 +00:00

77 lines
1.5 KiB
Nix

{
config,
pkgs,
lib,
...
}:
{
virtualisation = {
lxd = {
enable = true;
recommendedSysctlSettings = true;
};
libvirtd = {
enable = true;
qemu = {
ovmf.enable = true;
ovmf.packages = [
pkgs.OVMFFull.fd
] ++ lib.optional (pkgs.system == "x86_64-linux") pkgs.pkgsCross.aarch64-multiplatform.OVMF.fd;
swtpm.enable = true;
vhostUserPackages = [ pkgs.virtiofsd ];
runAsRoot = false;
};
onBoot = "ignore";
onShutdown = "shutdown";
};
};
# Breaks IPv4 on bridge
boot.kernel.sysctl."net.bridge.bridge-nf-call-iptables" = 0;
# lxd reduses this from default, increase this to what SteamOS uses
boot.kernel.sysctl."vm.max_map_count" = lib.mkForce 2147483642;
programs.virt-manager.enable = true;
environment.systemPackages = with pkgs; [
spice-gtk
qemu
];
users.users = {
artemis.extraGroups = [
"lxd"
"libvirtd"
];
lxd = {
isSystemUser = true;
subUidRanges = [
{
startUid = 16777216;
count = 16777216;
}
{
startUid = config.users.users.artemis.uid;
count = 1;
}
];
subGidRanges = [
{
startGid = 16777216;
count = 16777216;
}
{
startGid = 100;
count = 1;
}
{
startGid = config.users.groups.artemis.gid;
count = 1;
}
];
group = "lxd";
};
};
}