mirror of
https://git.oat.zone/dark-firepit/dotfiles
synced 2024-11-26 06:08:48 +01:00
20 lines
509 B
Nix
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;
|
||
|
}
|