tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
surrealdb: module init
authored by
happysalada
and committed by
Yt
3 years ago
82ee8249
bde8349b
+82
3 changed files
expand all
collapse all
unified
split
nixos
modules
module-list.nix
services
databases
surrealdb.nix
pkgs
servers
nosql
surrealdb
default.nix
+1
nixos/modules/module-list.nix
···
382
382
./services/databases/pgmanage.nix
383
383
./services/databases/postgresql.nix
384
384
./services/databases/redis.nix
385
385
+
./services/databases/surrealdb.nix
385
386
./services/databases/victoriametrics.nix
386
387
./services/desktops/accountsservice.nix
387
388
./services/desktops/bamf.nix
+79
nixos/modules/services/databases/surrealdb.nix
···
1
1
+
{ config, lib, pkgs, ... }:
2
2
+
3
3
+
with lib;
4
4
+
let
5
5
+
6
6
+
cfg = config.services.surrealdb;
7
7
+
in {
8
8
+
9
9
+
options = {
10
10
+
services.surrealdb = {
11
11
+
enable = mkEnableOption (lib.mdDoc "A scalable, distributed, collaborative, document-graph database, for the realtime web ");
12
12
+
13
13
+
dbPath = mkOption {
14
14
+
type = types.str;
15
15
+
description = lib.mdDoc ''
16
16
+
The path that surrealdb will write data to. Use null for in-memory.
17
17
+
Can be one of "memory", "file://:path", "tikv://:addr".
18
18
+
'';
19
19
+
default = "file:///var/lib/surrealdb/";
20
20
+
example = "memory";
21
21
+
};
22
22
+
23
23
+
host = mkOption {
24
24
+
type = types.str;
25
25
+
description = lib.mdDoc ''
26
26
+
The host that surrealdb will connect to.
27
27
+
'';
28
28
+
default = "127.0.0.1";
29
29
+
example = "127.0.0.1";
30
30
+
};
31
31
+
32
32
+
port = mkOption {
33
33
+
type = types.port;
34
34
+
description = lib.mdDoc ''
35
35
+
The port that surrealdb will connect to.
36
36
+
'';
37
37
+
default = 8000;
38
38
+
example = 8000;
39
39
+
};
40
40
+
};
41
41
+
};
42
42
+
43
43
+
config = mkIf cfg.enable {
44
44
+
45
45
+
# Used to connect to the running service
46
46
+
environment.systemPackages = [ pkgs.surrealdb ] ;
47
47
+
48
48
+
systemd.services.surrealdb = {
49
49
+
description = "A scalable, distributed, collaborative, document-graph database, for the realtime web ";
50
50
+
wantedBy = [ "multi-user.target" ];
51
51
+
after = [ "network.target" ];
52
52
+
53
53
+
serviceConfig = {
54
54
+
ExecStart = "${pkgs.surrealdb}/bin/surreal start --bind ${cfg.host}:${toString cfg.port} ${optionalString (cfg.dbPath != null) "-- ${cfg.dbPath}"}";
55
55
+
DynamicUser = true;
56
56
+
Restart = "on-failure";
57
57
+
StateDirectory = "surrealdb";
58
58
+
CapabilityBoundingSet = "";
59
59
+
NoNewPrivileges = true;
60
60
+
PrivateTmp = true;
61
61
+
ProtectHome = true;
62
62
+
ProtectClock = true;
63
63
+
ProtectProc = "noaccess";
64
64
+
ProcSubset = "pid";
65
65
+
ProtectKernelLogs = true;
66
66
+
ProtectKernelModules = true;
67
67
+
ProtectKernelTunables = true;
68
68
+
ProtectControlGroups = true;
69
69
+
ProtectHostname = true;
70
70
+
RestrictSUIDSGID = true;
71
71
+
RestrictRealtime = true;
72
72
+
RestrictNamespaces = true;
73
73
+
LockPersonality = true;
74
74
+
RemoveIPC = true;
75
75
+
SystemCallFilter = [ "@system-service" "~@privileged" ];
76
76
+
};
77
77
+
};
78
78
+
};
79
79
+
}
+2
pkgs/servers/nosql/surrealdb/default.nix
···
31
31
32
32
nativeBuildInputs = [
33
33
pkg-config
34
34
+
# needed on top of LIBCLANG_PATH to compile rquickjs
35
35
+
llvmPackages.clang
34
36
];
35
37
36
38
buildInputs = [ openssl ]