dotfiles/nixos/modules/sops.nix

58 lines
1.3 KiB
Nix
Raw Normal View History

{ flake, config, ... }:
let
inherit (flake.config.people)
2025-01-08 19:06:14 -06:00
user0
user2
2025-01-08 19:06:14 -06:00
;
inherit (flake.config.machines)
devices
;
hostname = config.networking.hostName;
desktop = devices.desktop.name;
2025-01-30 13:40:42 -06:00
server = devices.server.name;
fallaryn = devices.fallaryn.name;
2025-01-31 01:49:36 -06:00
bartholomew = devices.bartholomew.name;
userLogic =
if hostname == desktop then
user0
2025-01-30 13:40:42 -06:00
else if hostname == server then
user0
else if hostname == fallaryn then
user2
else
"";
in
{
2024-10-11 17:38:05 -05:00
sops = {
defaultSopsFile = ../../secrets/secrets.yaml;
validateSopsFiles = false;
age = {
keyFile = "/var/lib/sops-nix/key.txt";
generateKey = false;
};
2025-01-31 01:49:36 -06:00
secrets =
if hostname == bartholomew then
{ }
else
{
"ssh/private" = {
path = "/home/${userLogic}/.ssh/id_ed25519";
owner = userLogic;
};
"ssh/public" = {
path = "/home/${userLogic}/.ssh/id_ed25519.pub";
owner = userLogic;
};
"ssh/hosts" = {
path = "/home/${userLogic}/.ssh/known_hosts";
owner = userLogic;
};
# "claude-api-key" = {
# path = "/home/${user0}/.config/zed/claude-api-key";
# owner = user0;
# };
};
2024-10-11 17:38:05 -05:00
};
}