refactor: simplify 'user' options
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (config.host) username;
|
||||
in
|
||||
{
|
||||
options.ssh = {
|
||||
authorizedHosts = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
};
|
||||
username = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "h";
|
||||
};
|
||||
publicHostname = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
@@ -16,7 +16,7 @@
|
||||
};
|
||||
|
||||
# auto generate authorized_keys from `authorizedHosts`
|
||||
config.users.users.${config.ssh.username}.openssh.authorizedKeys.keys = lib.flatten (
|
||||
config.users.users.${username}.openssh.authorizedKeys.keys = lib.flatten (
|
||||
map (
|
||||
hostname:
|
||||
let
|
||||
|
||||
Reference in New Issue
Block a user