1
0
mirror of https://git.oat.zone/dark-firepit/dotfiles synced 2024-11-23 02:12:26 +01: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;
}