Move secrets out of Nix Store (#19)
Nix store is world-readable, and while nix repl fails to get the secret due to file permissions, we should still set up secrets without getting them in Nix store. In the past tmpfiles.d was used, but its entire contents get to the nix store. Now, all files with secrets are generated in activation scripts, with the help of jq and sed. Also dead Pleroma code was deleted, but CAPTCHA is still broken. Co-authored-by: inexcode <inex.code@selfprivacy.org> Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config/pulls/19 Co-authored-by: Inex Code <inex.code@selfprivacy.org> Co-committed-by: Inex Code <inex.code@selfprivacy.org>
This commit is contained in:
@@ -12,18 +12,12 @@ in
|
||||
{
|
||||
options.services.selfprivacy-api = {
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Enable SelfPrivacy API service
|
||||
'';
|
||||
};
|
||||
token = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
SelfPrivacy API token
|
||||
'';
|
||||
};
|
||||
enableSwagger = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
@@ -31,30 +25,12 @@ in
|
||||
Enable Swagger UI
|
||||
'';
|
||||
};
|
||||
b2AccountId = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
B2 account ID
|
||||
'';
|
||||
};
|
||||
b2AccountKey = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
B2 account key
|
||||
'';
|
||||
};
|
||||
b2Bucket = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
B2 bucket
|
||||
'';
|
||||
};
|
||||
resticPassword = mkOption {
|
||||
type = types.str;
|
||||
description = ''
|
||||
Restic password
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
@@ -64,12 +40,8 @@ in
|
||||
inherit (config.environment.sessionVariables) NIX_PATH;
|
||||
HOME = "/root";
|
||||
PYTHONUNBUFFERED = "1";
|
||||
AUTH_TOKEN = cfg.token;
|
||||
ENABLE_SWAGGER = (if cfg.enableSwagger then "1" else "0");
|
||||
B2_ACCOUNT_ID = cfg.b2AccountId;
|
||||
B2_ACCOUNT_KEY = cfg.b2AccountKey;
|
||||
B2_BUCKET = cfg.b2Bucket;
|
||||
RESTIC_PASSWORD = cfg.resticPassword;
|
||||
} // config.networking.proxy.envVars;
|
||||
path = [ "/var/" "/var/dkim/" pkgs.coreutils pkgs.gnutar pkgs.xz.bin pkgs.gzip pkgs.gitMinimal config.nix.package.out pkgs.nixos-rebuild pkgs.restic pkgs.mkpasswd ];
|
||||
after = [ "network-online.target" ];
|
||||
|
@@ -2,12 +2,8 @@
|
||||
{
|
||||
services.selfprivacy-api = {
|
||||
enable = true;
|
||||
token = config.services.userdata.api.token;
|
||||
enableSwagger = config.services.userdata.api.enableSwagger;
|
||||
b2AccountId = config.services.userdata.backblaze.accountId;
|
||||
b2AccountKey = config.services.userdata.backblaze.accountKey;
|
||||
b2Bucket = config.services.userdata.backblaze.bucket;
|
||||
resticPassword = config.services.userdata.resticPassword;
|
||||
};
|
||||
|
||||
users.users."selfprivacy-api" = {
|
||||
|
Reference in New Issue
Block a user