Problem with setting up home-manager to configure udev rules automatically

Hi,

Android page of the documentation mentions, that if I want to configure the udev rules, I can configure nix as such:

{
  services.udev.packages = [
    pkgs.android-udev-rules
  ];
}

When I add this section to my home-manager config, I’m getting the following error:

error:
       … while evaluating the attribute 'activationPackage'

         at /nix/store/7y28l2pbc1s8w308r68nl6vn43mpsang-home-manager/home-manager/modules/default.nix:54:3:

           53|
           54|   activationPackage = module.config.home.activationPackage;
             |   ^
           55|

       … while evaluating a branch condition

         at /nix/store/zk8ljigg8d95fqln8dn4rpxvg7fl685b-nixpkgs/nixpkgs/lib/lists.nix:57:9:

           56|       fold' = n:
           57|         if n == len
             |         ^
           58|         then nul

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: The option `services.udev' does not exist. Definition values:
       - In `/home/x/.config/home-manager/home.nix':
           {
             packages = [
               <derivation android-udev-rules-20230614>
             ];
           }

What gives? I’m new to nix so not sure how to approach it. I’m running Ubuntu v22.04.1, home-manager v23.11-pre. Is there anything that I’m missing?

services.udev is a NixOS option, not a home-manager one. You would need to be using NixOS to use this. You probably need to configure udev rules however that works in Ubuntu.