1
0
Fork 0
mirror of https://git.oat.zone/dark-firepit/dotfiles synced 2024-05-04 07:36:07 +02:00
git.oat.zone--dark-firepit-.../lib/helpers.nix
Jill "oatmealine" Monoids 39ec224d05 refactor authorizedKeys
2022-10-18 19:54:57 +02:00

20 lines
509 B
Nix

{ lib, ... }:
with lib;
rec {
indexFrom = origin: name: item: list: foldr
(h: t:
if h.${origin} == name && hasAttr item h
then h.${item}
else t)
(error ''
No item at the origin point ${origin} with element ${name} found.
Please make sure that the item with that origin exists, and,
failing that, that it also has the requested item defined.
'')
list;
getSSH = name: keys: indexFrom "hostname" name "ssh" keys;
getWG = name: keys: indexFrom "hostname" name "wg" keys;
}