Allow anyone in 'storage' or 'wheel' group to mount disks without a password using udisk rule on nixos

security.polkit.extraConfig = ''
  var YES = polkit.Result.YES;
  var perm_root = "org.freedesktop.udisks2";
  var perms = [
    "filesystem-mount",
    "filesystem-mount-system",
    "encrypted-unlock",
    "eject-media",
    "power-off-drive"
  ];
  var permission = {};
  for ( var x in perms ) {
    permission[perm_root + '.' + perms[x]] = polkit.Result.YES;
  }
  polkit.addRule(function(action, subject) {
    if (
      ( subject.isInGroup("storage")
        || subject.isInGroup("wheel") )
      && permission.hasOwnProperty(action.id)
      ) {
        return permission[action.id];
    }
  });
'';