Skip to content

Commit

Permalink
feat: support incus
Browse files Browse the repository at this point in the history
  • Loading branch information
misumisumi committed May 12, 2024
1 parent 9b0d17b commit b80acb5
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 8 deletions.
9 changes: 9 additions & 0 deletions apps/virtualisation/incus/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{ pkgs, ... }: {
environment.systemPackages = with pkgs; [ lxd-to-incus ];
virtualisation = {
incus = {
enable = true;
startTimeout = 300;
};
};
}
9 changes: 2 additions & 7 deletions apps/virtualisation/lxd/default.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{ inputs, pkgs, ... }: {

system.activationScripts.virtiofs.text = ''
mkdir -p /usr/lib/qemu
ln -sf ${pkgs.virtiofsd}/bin/virtiofsd /usr/lib/qemu/virtiofsd
'';
{
virtualisation = {
lxc.enable = true;
lxc.lxcfs.enable = true;
lxd = {
enable = true;
recommendedSysctlSettings = true;
Expand Down
1 change: 1 addition & 0 deletions machines/stacia/virtualisation.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
imports = [
../../apps/virtualisation/incus
../../apps/virtualisation/libvirt
../../apps/virtualisation/lxd
../../apps/virtualisation/podman
Expand Down
10 changes: 10 additions & 0 deletions modules/virtualisation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ in
};

config = {
# Place the virtiofsd directory in an FHS compliant location
system.activationScripts.virtiofs.text =
let
check_virtualisation = with config.virtualisation; lxc.enable || lxd.enable || incus.enable || libvirtd.enable;
in
optionalString check_virtualisation ''
mkdir -p /usr/lib/qemu
ln -sf ${pkgs.virtiofsd}/bin/virtiofsd /usr/lib/qemu/virtiofsd
'';

systemd.tmpfiles.rules =
mapAttrsToList tmpfileEntry cfg.sharedMemoryFiles;

Expand Down
2 changes: 1 addition & 1 deletion system/user/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
users.users.${user} = {
isNormalUser = true;
shell = pkgs.zsh;
extraGroups = [ "wheel" "uucp" "kvm" "input" "audio" "video" "scanner" "lp" "lxd" ];
extraGroups = [ "wheel" "uucp" "kvm" "input" "audio" "video" "scanner" "lp" "lxd" "incus-admin" ];
useDefaultShell = true;
subUidRanges = [
# Using rootless container
Expand Down

0 comments on commit b80acb5

Please sign in to comment.