Incus preseed config

Hello, I am trying to initialyse incus server with:

  virtualisation.incus = {
    enable = true;
    package = pkgs.incus;
    preseed = {

      config = {
        core.https_address = ":8443";
      };
    ......
  };

I cannot pass the config key/value. This config = { … }; does not work for me.
Ths for your help.

try "core.https_address" instead of core.https_address

thx but it didnt work…
I can create profiles, etc but when I try do put preseed.config it does work at all.
Did you try by yourself already? thx

can you please explain how things aren’t working? specific errors, etc…

Yes, thx! Here is my full code concerning incus in configuration.nix:

# incus !
  networking.nftables.enable = true;  
  virtualisation.incus = {
    enable = true;
    package = pkgs.incus;
    preseed = {
    
      #config = {
       # "core.https_address" = ":8443";
       # "backups.compression_algorithm" = "bzip2";
      #};
      
      profiles = [
        {
          
          devices = {
            root = {
    	      path = "/";
    	      pool = "default";
    	      type = "disk";
    	    };
          };
    	  name = "default";
        }
        {
          devices = {
            eth0 = {
              name = "eth0";
    	      parent = "bridge0";
    	      type = "nic";
    	      nictype = "bridged";
    	    };
          };
    	  name = "bridgeprofile";
    	  description = "merci Scott";
        }
      ];
      
      storage_pools = [
        {
          config = {
            source = "/dev/sdb1";
          };
          driver = "zfs";
          name = "default";
        }
      ];
        	
    };
  };

I want NixOS to initialize incus, so I do the following:
1/ sudo systemctl stop incus.service incus.socket incus-preseed.service
2/ sudo rm -r /var/lib/incus
3/ sudo fdisk /dev/sdb for creating empy and not formated partition /dev/sdb1
4/ edit /etc/nixos/configuration.nix
5/ sudo nixos-rebuild switch
6/ reboot

It works perfectly and silently with commented:

    #config = {
       # "core.https_address" = ":8443";
       # "backups.compression_algorithm" = "bzip2";
      #};

It creates the bridgeprofile, the zfs storage pool, etc.

But if uncomment, it does not work…silently. It does 1 to 6 but no profiles and storage pools are created.
Well I did some journalctl -r to see what it is happening, spending to much time on it…

juin 04 10:49:01 ALPHA systemd[1]: Failed to start Incus initialization with preseed file.
juin 04 10:49:01 ALPHA systemd[1]: incus-preseed.service: Failed with result 'exit-code'.
juin 04 10:49:01 ALPHA systemd[1]: incus-preseed.service: Main process exited, code=exited, status=1/FAILURE
juin 04 10:49:01 ALPHA incus-preseed-start[931]:   line 4: cannot unmarshal !!map into string
juin 04 10:49:01 ALPHA incus-preseed-start[931]: Error: Failed to parse the preseed: yaml: unmarshal errors:
juin 04 10:49:01 ALPHA systemd[1]: Starting Incus initialization with preseed file...

OK it worked :smile:

config = {
      "core.https_address" = ":8443";
      "images.auto_update_interval" = 15;
      };

Before:

[alain@ALPHA:~]$ incus config show
config:
  core.https_address: :8443
  images.auto_update_interval: "18"

After (playing with incus-preseed.service:

[alain@ALPHA:~]$ sudo systemctl restart incus-preseed
Job for incus-preseed.service failed because the control process exited with error code.
See "systemctl status incus-preseed.service" and "journalctl -xeu incus-preseed.service" for details.

[alain@ALPHA:~]$ systemctl status incus-preseed.service
× incus-preseed.service - Incus initialization with preseed file
     Loaded: loaded (/etc/systemd/system/incus-preseed.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2024-06-04 14:53:49 CEST; 2min 10s ago
    Process: 15270 ExecStart=/nix/store/p9ym6i6yaxa0bv27s9qvn4a6d1w2ph4b-unit-script-incus-preseed-start/bin/incus-preseed-start (c>
   Main PID: 15270 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 43ms

juin 04 14:53:49 ALPHA systemd[1]: Starting Incus initialization with preseed file...
juin 04 14:53:49 ALPHA incus-preseed-start[15271]: Error: Failed to update storage pool "default": Pool source cannot be changed wh>
juin 04 14:53:49 ALPHA systemd[1]: incus-preseed.service: Main process exited, code=exited, status=1/FAILURE
juin 04 14:53:49 ALPHA systemd[1]: incus-preseed.service: Failed with result 'exit-code'.
juin 04 14:53:49 ALPHA systemd[1]: Failed to start Incus initialization with preseed file.
lines 1-13/13 (END)


[alain@ALPHA:~]$ incus config show
config:
  core.https_address: :8443
  images.auto_update_interval: "15"

So 15 intead of 18.

And you were right putting the cotes solved it. Key/value: and Key must be string here, a little bit tricky…
Thx a lot