2024-10-26 18:29:35 +02:00
|
|
|
{ lib }:
|
|
|
|
let
|
2024-12-15 17:22:49 +01:00
|
|
|
inherit (lib)
|
|
|
|
filterAttrs
|
|
|
|
trim
|
|
|
|
splitString
|
|
|
|
filter
|
|
|
|
hasPrefix
|
|
|
|
readFile
|
|
|
|
mapAttrs'
|
|
|
|
removeSuffix
|
|
|
|
;
|
2024-10-26 18:29:35 +02:00
|
|
|
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
|