config-perso/kat/ssh-keys/default.nix

15 lines
367 B
Nix

{ lib }:
with lib;
let
key-files = filterAttrs (name: _: name != "default.nix") (builtins.readDir ./.);
readKeys =
file:
let
lines = map trim (splitString "\n" (readFile file));
in
filter (line: line != "" && !hasPrefix "#" line) lines;
in
mapAttrs' (name: _: {
name = removeSuffix ".keys" name;
value = readKeys ./${name};
}) key-files