Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
C4F3Z1N committed May 16, 2024
1 parent 74c0ecc commit 1221758
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nixos/modules/openssh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ let
hostPubKeys = lib.pipe "${inputs.secrets}/public-keys.json" [
(lib.importJSON)
(builtins.getAttr "hosts")
(builtins.mapAttrs (_: keys: filterSshKeys keys))
(builtins.mapAttrs (_: filterSshKeys))
];
customKnownHosts = lib.pipe hostPubKeys [
(lib.mapAttrsToList (name: keys:
lib.pipe keys [ (builtins.attrValues) (map (key: "${name} ${key}")) ]))
(lib.flatten)
(lib.concatLines)
(pkgs.writeText "known_hosts")
(builtins.toFile "known_hosts")
];
in {
services.openssh = {
Expand All @@ -22,7 +22,7 @@ in {
# use public keys to force 'HostKeyAgent' lookup;
hostKeys = lib.mapAttrsToList (type: key: {
inherit type;
path = pkgs.writeText "${hostName}-${type}.pub" key;
path = builtins.toFile "${hostName}-${type}.pub" key;
}) hostPubKeys."${hostName}";

settings = {
Expand Down

0 comments on commit 1221758

Please sign in to comment.