programs.ssh.knownHosts: Use attribute name
This allows writing: programs.ssh.knownHosts."10.1.2.3".publicKey = "bar"; instead of programs.ssh.knownHosts = [ { hostNames = [ "10.1.2.3" ]; publicKey = "bar"; } ];
This commit is contained in:
parent
7c6ff6c1da
commit
f6eece6f8f
@ -21,7 +21,7 @@ let
|
|||||||
knownHosts = map (h: getAttr h cfg.knownHosts) (attrNames cfg.knownHosts);
|
knownHosts = map (h: getAttr h cfg.knownHosts) (attrNames cfg.knownHosts);
|
||||||
|
|
||||||
knownHostsText = flip (concatMapStringsSep "\n") knownHosts
|
knownHostsText = flip (concatMapStringsSep "\n") knownHosts
|
||||||
(h:
|
(h: assert h.hostNames != [];
|
||||||
concatStringsSep "," h.hostNames + " "
|
concatStringsSep "," h.hostNames + " "
|
||||||
+ (if h.publicKey != null then h.publicKey else readFile h.publicKeyFile)
|
+ (if h.publicKey != null then h.publicKey else readFile h.publicKeyFile)
|
||||||
);
|
);
|
||||||
@ -102,7 +102,7 @@ in
|
|||||||
|
|
||||||
knownHosts = mkOption {
|
knownHosts = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
type = types.loaOf (types.submodule {
|
type = types.loaOf (types.submodule ({ name, ... }: {
|
||||||
options = {
|
options = {
|
||||||
hostNames = mkOption {
|
hostNames = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
@ -136,7 +136,10 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
config = {
|
||||||
|
hostNames = mkDefault [ name ];
|
||||||
|
};
|
||||||
|
}));
|
||||||
description = ''
|
description = ''
|
||||||
The set of system-wide known SSH hosts.
|
The set of system-wide known SSH hosts.
|
||||||
'';
|
'';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user