0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

Merge master into staging-next

This commit is contained in:
github-actions[bot] 2022-12-10 18:01:12 +00:00 committed by GitHub
commit fe25c2a8d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 204 additions and 84 deletions

View file

@ -58,7 +58,7 @@ let
'' + optionalString (cfg.prune.keep != { }) ''
borg prune $extraArgs \
${mkKeepArgs cfg} \
${optionalString (cfg.prune.prefix != null) "--prefix ${escapeShellArg cfg.prune.prefix} \\"}
${optionalString (cfg.prune.prefix != null) "--glob-archives ${escapeShellArg "${cfg.prune.prefix}*"}"} \
$extraPruneArgs
${cfg.postPrune}
'';

View file

@ -37,6 +37,20 @@ in {
default = 8000;
example = 8000;
};
userNamePath = mkOption {
type = types.path;
description = lib.mdDoc ''
Path to read the username from.
'';
};
passwordPath = mkOption {
type = types.path;
description = lib.mdDoc ''
Path to read the password from.
'';
};
};
};
@ -50,8 +64,19 @@ in {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
script = ''
${pkgs.surrealdb}/bin/surreal start \
--user $(${pkgs.systemd}/bin/systemd-creds cat SURREALDB_USERNAME) \
--pass $(${pkgs.systemd}/bin/systemd-creds cat SURREALDB_PASSWORD) \
--bind ${cfg.host}:${toString cfg.port} \
-- ${cfg.dbPath}
'';
serviceConfig = {
ExecStart = "${pkgs.surrealdb}/bin/surreal start --bind ${cfg.host}:${toString cfg.port} ${optionalString (cfg.dbPath != null) "-- ${cfg.dbPath}"}";
LoadCredential = [
"SURREALDB_USERNAME:${cfg.userNamePath}"
"SURREALDB_PASSWORD:${cfg.passwordPath}"
];
DynamicUser = true;
Restart = "on-failure";
StateDirectory = "surrealdb";