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

16 lines
367 B
Nix
Raw Permalink Normal View History

2024-10-26 18:29:35 +02:00
{ 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