I am trying to extend users.users
submodule with a new option. I am using sshd.nix as an example, but it’s failing with:
error: The option `users.users' in `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/networking/ssh/sshd.nix' is already declared in `modules/mymodule'.
I am assuming one of the conditions here are failing, but the error message is not exactly helpful, so I can’t tell which one.
Here is my test module (same as sshd module just with renamed option):
{ config, lib, pkgs, ... }:
with lib;
let
userOptions = {
options.openssh2.authorizedKeys = {
keys = mkOption {
type = types.listOf types.str;
default = [];
};
};
};
in {
options = {
users.users = mkOption {
type = with types; attrsOf (submodule userOptions);
};
};
}
Any ideas how to get this to merge?
Thank you!