mirror of
https://github.com/sstent/vmimages.git
synced 2026-01-25 14:41:44 +00:00
Working Config With Libs!
This commit is contained in:
31
lib/hm_secrets.nix
Normal file
31
lib/hm_secrets.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{lib, ...}: let
|
||||
inherit
|
||||
(builtins)
|
||||
readDir
|
||||
;
|
||||
|
||||
inherit
|
||||
(lib)
|
||||
filterAttrs
|
||||
hasPrefix
|
||||
hasSuffix
|
||||
mapAttrs'
|
||||
nameValuePair
|
||||
|
||||
;
|
||||
in rec {
|
||||
filter = name: func: attrs: filterAttrs name (mapAttrs' func attrs);
|
||||
|
||||
# 'sops' Encrypted Secrets
|
||||
hm_secrets = dir: out_dir:
|
||||
filter (name: type: type != null && !(hasPrefix "_" name)) (name: type:
|
||||
if type == "regular" && hasSuffix ".age" name
|
||||
then
|
||||
nameValuePair name {
|
||||
sopsFile = dir + "/${name}";
|
||||
format = "binary";
|
||||
path = out_dir + "/${name}";
|
||||
|
||||
}
|
||||
else nameValuePair "" null) (readDir dir);
|
||||
}
|
||||
Reference in New Issue
Block a user