Can't Configure sysctl.unprivileged_userns_clone for Plex

Hello! I just install Plex on one of my NixOS servers. Unfortunately, I get the following error when I try to start it up:

Nov 14 19:56:57 david plexmediaserver[1937]: bwrap: No permissions to 
creating new namespace, likely because the kernel does not allow 
non-privileged user namespaces. On e.g. debian this can be enabled 
with 'sysctl kernel.unprivileged_userns_clone=1'.

I therefore added the following to my /etc/configuration.nix file:

  boot = {
    kernel.sysctl = {
      "unprivileged_userns_clone" = 1; # for plex
    };
  };

However, after running nixos-rebuilt --switch and rebooting I still see the following when I run the sysctl -a command:

kernel.unprivileged_userns_clone = 0

Is there another step I’m missing?

I found my typo! I thought that I needed to remove the kernel part from kernel.unprivileged_userns_clone because it was already part of the option name. However, this config solved my problem:

  boot = {
    kernel.sysctl = {
      "kernel.unprivileged_userns_clone" = 1; # for plex
    };
  };