readbility improvement for keys file

This commit is contained in:
Haak Saxberg 2023-11-04 16:39:38 -07:00
parent 94e1ecf78a
commit 05519bc412

View file

@ -1,22 +1,30 @@
let
ifExists = path: if builtins.pathExists path then path else null;
readIfExists = path: if builtins.pathExists path then builtins.readFile path else null;
in
{ {
ssh = { ssh = {
public = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMd7+5+rLGrsGbg+mXjzQLqwAR2VNNFPCb7Va4FqVwd7 haak@framework"; public = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMd7+5+rLGrsGbg+mXjzQLqwAR2VNNFPCb7Va4FqVwd7 haak@framework";
}; };
syncthing = { syncthing = {
cert = if builtins.pathExists "/home/haak/dotfiles/secrets/syncthing/cert.pem" then "/home/haak/dotfiles/secrets/syncthing/cert.pem" else null; cert = ifExists "/home/haak/dotfiles/secrets/syncthing/cert.pem";
key = if builtins.pathExists "/home/haak/dotfiles/secrets/syncthing/key.pem" then "/home/haak/dotfiles/secrets/syncthing/key.pem" else null; key = ifExists "/home/haak/dotfiles/secrets/syncthing/key.pem";
}; };
wifi = { wifi = {
# These wifi names must match exactly the network names used for # These wifi names must match exactly the network names used for
# wpa_supplicant configuration! # wpa_supplicant configuration!
N904 = { N904 = {
pskRaw = if builtins.pathExists "/home/haak/dotfiles/secrets/wifi/n904/pskRaw.txt" then builtins.readFile "/home/haak/dotfiles/secrets/wifi/n904/pskRaw.txt" else null; pskRaw = readIfExists "/home/haak/dotfiles/secrets/wifi/n904/pskRaw.txt";
}; };
"ShamblingHalfling 5Ghz-1" = { "ShamblingHalfling 5Ghz-1" = {
pskRaw = if builtins.pathExists "/home/haak/dotfiles/secrets/wifi/ShamblingHalfling 5Ghz-1/pskRaw.txt" then builtins.readFile "/home/haak/dotfiles/secrets/wifi/ShamblingHalfling 5Ghz-1/pskRaw.txt" else null; pskRaw = readIfExists "/home/haak/dotfiles/secrets/wifi/ShamblingHalfling 5Ghz-1/pskRaw.txt";
};
lbheim = {
pskRaw = readIfExists "/home/haak/dotfiles/secrets/wifi/lbheim/pskRaw.txt";
}; };
}; };
} }