summaryrefslogtreecommitdiff
path: root/lib/files.nix
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-06-24 11:51:39 -0400
committerFreya Murphy <freya@freyacat.org>2025-06-24 11:51:39 -0400
commitd639c293ad1ba71008aeb5c54c40f59a076018dc (patch)
treee832a3f0ee5044c8b35e5642f07a62137bbffc2c /lib/files.nix
parentupdate ssh config (diff)
downloaddotfiles-nix-d639c293ad1ba71008aeb5c54c40f59a076018dc.tar.gz
dotfiles-nix-d639c293ad1ba71008aeb5c54c40f59a076018dc.tar.bz2
dotfiles-nix-d639c293ad1ba71008aeb5c54c40f59a076018dc.zip
redo lib, make global vars for key lists
Diffstat (limited to '')
-rw-r--r--lib/files.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/files.nix b/lib/files.nix
new file mode 100644
index 0000000..18439d9
--- /dev/null
+++ b/lib/files.nix
@@ -0,0 +1,23 @@
+{lib, ...}: let
+
+ # gets list of files from a directory
+ getFiles = folder:
+ lib.attrsets.mapAttrsToList (name: type: "${folder}/${name}") (builtins.readDir folder);
+
+ # gets custom set of root certs
+ certs = getFiles ../files/certs;
+
+ # set of ssh keys
+ sshKeys = builtins.filter
+ (path: lib.strings.hasSuffix "pub" path) (getFiles ../files/keys);
+
+ # set of gpg keys
+ gpgKeys = builtins.filter
+ (path: lib.strings.hasSuffix "asc" path) (getFiles ../files/keys);
+
+in {
+ inherit getFiles;
+ inherit certs;
+ inherit sshKeys;
+ inherit gpgKeys;
+}