Noobie Question about makeAutostartItem

Hey everyone :slight_smile:

Im relatively new to nixos, but have managed to set up my system mostly the way i wanted by just google-ing around and stealing code-snippest. However i can’t work this one out:

I have this Section in my gaming-configuration, which is included into configuration.nix:

  # Corsair Harware Driver
  hardware.ckb-next.enable = true;
  ckb_autostart = (pkgs.makeAutostartItem {
    name = "ckb-next";
    package = "ckb-next";
  });

Which, the first line, works fine. It Installs ckb-next and enables the Daemon. I can use the application normally.

But when trying to build that configuration, i get the following error:

error:
       … while evaluating the attribute 'config'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:326:9:

          325|         options = checked options;
          326|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          327|         _module = checked (config._module);

       error: The option `ckb_autostart' does not exist. Definition values:
       - In `/etc/nixos/software/gaming.nix': <derivation autostart-ckb-next>
building Nix...
error:
       … while evaluating the attribute 'config'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:326:9:

          325|         options = checked options;
          326|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          327|         _module = checked (config._module);

       error: The option `ckb_autostart' does not exist. Definition values:
       - In `/etc/nixos/software/gaming.nix': <derivation autostart-ckb-next>
building the system configuration...
error:
       … while evaluating the attribute 'config.system.build.toplevel'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:326:9:

          325|         options = checked options;
          326|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          327|         _module = checked (config._module);

       error: The option `ckb_autostart' does not exist. Definition values:
       - In `/etc/nixos/software/gaming.nix': <derivation autostart-ckb-next>

The only examples of makeAutostartItem that i have found, use exactly the same Syntax. I am sort of stuck here. I’d be happy if someone could help me out on this one.

You are trying to set the option ckb_autostart to (pkgs.makeAutostartItem { name = "ckb-next"; package = "ckb-next"; })

but this option does not exist.

(pkgs.makeAutostartItem { name = "ckb-next"; package = "ckb-next"; }) creates a package and thus needs to go in your environment.systemPackages.