mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-24 16:39:42 -04:00
changed imports to mkImports
This commit is contained in:
parent
649d9e83b6
commit
930f5272b8
34 changed files with 66 additions and 448 deletions
26
src/user/config/keys/default.nix
Normal file
26
src/user/config/keys/default.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
with builtins;
|
||||
let
|
||||
extractName = string:
|
||||
let
|
||||
metadata = [
|
||||
"pub" "public" "priv" "private"
|
||||
"key" "file" "." "_" "-" "pk"
|
||||
];
|
||||
in
|
||||
replaceStrings metadata (builtins.map (_: "") metadata) string;
|
||||
|
||||
constructKeys = dir: (
|
||||
listToAttrs (
|
||||
map (subdir: {
|
||||
name = subdir;
|
||||
value = listToAttrs (
|
||||
map (file: {
|
||||
name = extractName file;
|
||||
value = readFile "${dir}/${subdir}/${file}";
|
||||
}) (filter (node: (readDir "${dir}/${subdir}").${node} == "regular") (attrNames (readDir "${dir}/${subdir}")))
|
||||
);
|
||||
}) (filter (node: (readDir dir).${node} == "directory") (attrNames (readDir dir)))
|
||||
)
|
||||
);
|
||||
in
|
||||
constructKeys ./.
|
||||
Loading…
Add table
Add a link
Reference in a new issue