Files
nix-config/hosts/nas/sops.nix
2025-03-19 16:11:49 -05:00

155 lines
5.0 KiB
Nix
Executable File

{ config, ... }:
let
user = "admin";
in
{
# Permission modes are in octal representation (same as chmod),
# the digits represent: user|group|others
# 7 - full (rwx)
# 6 - read and write (rw-)
# 5 - read and execute (r-x)
# 4 - read only (r--)
# 3 - write and execute (-wx)
# 2 - write only (-w-)
# 1 - execute only (--x)
# 0 - none (---)
# Either a user id or group name representation of the secret owner
# It is recommended to get the user name from `config.users.users.<?name>.name` to avoid misconfiguration
# Either the group id or group name representation of the secret group
# It is recommended to get the group name from `config.users.users.<?name>.group` to avoid misconfiguration
sops = {
defaultSopsFile = ../../secrets/secrets.yaml;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
# ------------------------------
# Secrets
# ------------------------------
secrets = {
"jallen-nas/admin_password" = {
neededForUsers = true;
mode = "0600";
owner = config.users.users."${user}".name;
group = config.users.users."${user}".group;
};
"wifi" = { };
"jallen-nas/ups_password" = {
mode = "0777";
# restartUnits = [ "ups stuff lol" ];
};
"jallen-nas/collabora" = {
restartUnits = [ "podman-collabora.service" ];
};
"jallen-nas/mariadb/db_pass" = {
restartUnits = [ "podman-mariadb.service" ];
};
"jallen-nas/mariadb/root_pass" = {
restartUnits = [ "podman-mariadb.service" ];
};
"jallen-nas/nextcloud/dbpassword" = {
restartUnits = [ "podman-nextcloud.service" ];
};
"jallen-nas/nextcloud/adminpassword" = {
restartUnits = [ "podman-nextcloud.service" ];
};
"jallen-nas/nextcloud/smtppassword" = {
restartUnits = [ "podman-nextcloud.service" ];
};
"jallen-nas/manyfold/secretkeybase" = {
restartUnits = [ "podman-manyfold.service" ];
};
"jallen-nas/immich/db-password" = {
restartUnits = [ "podman-immich-postgres.service" ];
};
"jallen-nas/immich/db-name" = {
restartUnits = [ "podman-immich-postgres.service" ];
};
"jallen-nas/immich/db-user" = {
restartUnits = [ "podman-immich-postgres.service" ];
};
"jallen-nas/immich/server-db-password" = {
restartUnits = [ "podman-immich-server.service" ];
};
"jallen-nas/immich/server-db-name" = {
restartUnits = [ "podman-immich-server.service" ];
};
"jallen-nas/immich/server-db-user" = {
restartUnits = [ "podman-immich-server.service" ];
};
"jallen-nas/open-webui" = {
restartUnits = [ "open-webui.service" ];
};
"jallen-nas/netdata-token" = {
restartUnits = [ "netdata.service" ];
};
"jallen-nas/onlyoffice-key" = {
restartUnits = [ "podman-onlyoffice.service" ];
};
"jallen-nas/paperless/secret" = {
restartUnits = [ "container@paperless.service" ];
};
secrets."jallen-nas/paperless/authentik-client-id" = {
restartUnits = [ "container@paperless.service" ];
};
"jallen-nas/paperless/authentik-client-secret" = {
restartUnits = [ "container@paperless.service" ];
};
"jallen-nas/nextcloud/dbpassword" = {
mode = "0777";
};
"jallen-nas/nextcloud/adminpassword" = {
mode = "0777";
};
"ssh-keys-public/jallen-nas-root" = {
path = "/root/.ssh/id_ed25519.pub";
mode = "0600";
};
"ssh-keys-private/jallen-nas-root" = {
path = "/root/.ssh/id_ed25519";
mode = "0600";
};
"secureboot/GUID" = {
path = "/etc/secureboot/GUID";
mode = "0600";
};
"secureboot/keys/db-key" = {
path = "/etc/secureboot/keys/db/db.key";
mode = "0600";
};
"secureboot/keys/db-pem" = {
path = "/etc/secureboot/keys/db/db.pem";
mode = "0600";
};
"secureboot/keys/KEK-key" = {
path = "/etc/secureboot/keys/KEK/KEK.key";
mode = "0600";
};
"secureboot/keys/KEK-pem" = {
path = "/etc/secureboot/keys/KEK/KEK.pem";
mode = "0600";
};
"secureboot/keys/PK-key" = {
path = "/etc/secureboot/keys/PK/PK.key";
mode = "0600";
};
"secureboot/keys/PK-pem" = {
path = "/etc/secureboot/keys/PK/PK.pem";
mode = "0600";
};
};
templates = {
"nextcloud-smtp".content = ''
${config.sops.secrets."jallen-nas/nextcloud/smtppassword"}
'';
"paperless-secret".content = ''
${config.sops.secrets."jallen-nas/paperless/secret".path}
'';
"paperless-client-id".content = ''
${config.sops.secrets."jallen-nas/paperless/authentik-client-id".path}
'';
"paperless-client-secret".content = ''
${config.sops.secrets."jallen-nas/paperless/authentik-client-secret".path}
'';
};
};
}