Hi folks,
After couple of hours install/re-install a finally find a working state:
- incus version (6.12)
- images:nixos/25.05
- vm
I hope this tutorial provides some visibility and guidance to make testing and installing NixOS in Incus easier.
- incus-agent refuse to start properly by default, none tutorial work (read only system/ config )
- but I found a fix ⦠see last part.
List image
To find the right image.
incus image list images:nixos
Create
Force memory limit + fix for qemu (a small bug with slot)
Address space limit 0xfffffffff < 0x147fffffff phys-bits too low (36)
Adjust your memory settings:
incus create images:nixos/25.05 --vm nixos << EOF
config:
limits.memory: 4GiB
raw.qemu.conf: |-
[memory]
maxmem = "16384M"
size = "4096M"
slots=8
security.secureboot: "false"
EOF
First Start
Check you network configuration.
incus start nixos --console
----- wait boot
nix-channel --update
Setup Config
note that incus.agent is disabled.
echo {} > /etc/nixos/incus.nix
## add patch.nix into configuration.nix
cat <<EOF > /etc/nixos/patch.nix
{ modulesPath, pkgs, ... }:
{
environment.systemPackages = with pkgs; [ vim curl wget zsh ];
services.openssh.enable = true;
virtualisation.incus.agent.enable= false;
users.users.whoo = {
description = "first user";
password= "changeme";
isNormalUser= true;
extraGroups = [ "wheel" ];
group = "users";
};
}
EOF
nixos-rebuild switch
Tada
Last minute check
Regarding incus-agent ⦠It seems that glibc is not correctly configured in my configuration/incus.nix
/run/incus_agent/incus-agent
bash: /run/incus_agent/incus-agent: cannot execute: required file not found
# works
/nix/store/[xxxxxx]-glibc-2.40-66/lib64/ld-linux-x86-64.so.2 /run/incus_agent/incus-agent
So I find a way to add lib64 with system.activationScripts.ldso
and nix-ld
patch.
echo {} > /etc/nixos/incus.nix
## add patch.nix into configuration.nix
cat <<EOF > /etc/nixos/patch.nix
{ modulesPath, pkgs, lib, ... }:
{
environment.systemPackages = with pkgs; [ vim curl wget zsh strace file glibc];
services.openssh.enable = true;
virtualisation.incus.agent.enable = true;
programs.nix-ld.enable = true;
system.activationScripts.ldso = lib.stringAfter [ "usrbinenv" ] ''
mkdir -m 0755 -p /lib64
ln -sfn \${pkgs.glibc.out}/lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2.tmp
mv -f /lib64/ld-linux-x86-64.so.2.tmp /lib64/ld-linux-x86-64.so.2 # atomically replace
'';
users.users.whoo = {
description = "first user";
password= "changeme";
isNormalUser= true;
extraGroups = [ "wheel" ];
group = "users";
};
}
EOF
nixos-rebuild switch
And Tadaaaaamm.