Files
nixos.server/modules/features/sops/default.nix
2026-11-16 13:18:10 +00:00

87 lines
3.2 KiB
Nix

{
self,
inputs,
...
}: {
flake.nixosModules.secrets = {
config,
lib,
pkgs,
...
}: {
imports = [inputs.sops-nix.nixosModules.sops];
sops = {
age.keyFile = "/etc/sops/age/keys.txt";
defaultSopsFile = ../../../secrets/secrets.yaml;
secrets = {
lidarr-api-key = {};
gitea-db-passwd = {};
immich-api-key = {};
immich-db-passwd = {};
immich-postgres-passwd = {};
mail-relay-user = {};
mail-relay-passwd = {};
silverbullet-user = {};
paperless-ngx-key = {};
paperless-postgres-password = {};
matrix-postgres-password = {};
matrix-livekit-key = {};
matrix-livekit-secret = {};
homepage-jellyfin-url = {};
homepage-jellyfin-api_key = {};
homepage-jellyfin-playlist_id = {};
homepage-jellyfin-user_id = {};
homepage-jellyfin-library_id = {};
homepage-komga-url = {};
homepage-komga-api_key = {};
homepage-komga-library_id = {};
homepage-blog-url = {};
homepage-google-api_key = {};
homepage-channel-id = {};
};
templates = {
"gitea.env".content = ''
GITEA__database__PASSWD=${config.sops.placeholder.gitea-db-passwd}
MYSQL_PASSWORD=${config.sops.placeholder.gitea-db-passwd}
MYSQL_ROOT_PASSWORD=${config.sops.placeholder.gitea-db-passwd}
'';
"immich.env".content = ''
DB_PASSWORD=${config.sops.placeholder.immich-db-passwd}
IMMICH_API_KEY=${config.sops.placeholder.immich-api-key}
POSTGRES_PASSWORD=${config.sops.placeholder.immich-postgres-passwd}
'';
"mail.env".content = ''
RELAY_USER=${config.sops.placeholder.mail-relay-user}
RELAY_PASSWORD=${config.sops.placeholder.mail-relay-passwd}
'';
"silverbullet.env".content = ''
SB_USER=${config.sops.placeholder.silverbullet-user}
'';
"paperless.env".content = ''
POSTGRES_PASSWORD=${config.sops.placeholder.paperless-postgres-password}
PAPERLESS_SECRET_KEY=${config.sops.placeholder.paperless-ngx-key}
'';
"livekit.env".content = ''
LIVEKIT_KEY=${config.sops.placeholder.matrix-livekit-key}
LIVEKIT_SECRET=${config.sops.placeholder.matrix-livekit-secret}
'';
"homepage.env".content = ''
JELLYFIN_URL=${config.sops.placeholder.homepage-jellyfin-url}
JELLYFIN_API_KEY=${config.sops.placeholder.homepage-jellyfin-api_key}
JELLYFIN_PLAYLIST_ID=${config.sops.placeholder.homepage-jellyfin-playlist_id}
JELLYFIN_USER_ID=${config.sops.placeholder.homepage-jellyfin-user_id}
JELLYFIN_LIBRARY_ID=${config.sops.placeholder.homepage-jellyfin-library_id}
KOMGA_URL=${config.sops.placeholder.homepage-komga-url}
KOMGA_API_KEY=${config.sops.placeholder.homepage-komga-api_key}
KOMGA_LIBRARY_ID=${config.sops.placeholder.homepage-komga-library_id}
BLOG_URL=${config.sops.placeholder.homepage-blog-url}
GOOGLE_API_KEY=${config.sops.placeholder.homepage-google-api_key}
CHANNEL_ID=${config.sops.placeholder.homepage-channel-id}
'';
};
};
};
}