nixos/surrealdb: incorporate beta 10 changes

This commit is contained in:
happysalada 2023-09-06 06:17:31 -04:00 committed by Yt
parent 3d8c6b5b94
commit 5ae2b27518

View file

@ -47,17 +47,13 @@ in {
example = 8000;
};
userNamePath = mkOption {
type = types.path;
extraFlags = mkOption {
type = types.listOf types.str;
default = [];
example = [ "--allow-all" "--auth" "--user root" "--pass root" ];
description = lib.mdDoc ''
Path to read the username from.
'';
};
passwordPath = mkOption {
type = types.path;
description = lib.mdDoc ''
Path to read the password from.
Specify a list of additional command line flags,
which get escaped and are then passed to surrealdb.
'';
};
};
@ -73,19 +69,8 @@ in {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
script = ''
${cfg.package}/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 = {
LoadCredential = [
"SURREALDB_USERNAME:${cfg.userNamePath}"
"SURREALDB_PASSWORD:${cfg.passwordPath}"
];
ExecStart = "${cfg.package}/bin/surreal start --bind ${cfg.host}:${toString cfg.port} ${escapeShellArgs cfg.extraFlags} -- ${cfg.dbPath}";
DynamicUser = true;
Restart = "on-failure";
StateDirectory = "surrealdb";