-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdynamodb.module.nix
40 lines (38 loc) · 1.05 KB
/
dynamodb.module.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Copyright © Brrr Authors
#
# Licensed under AGPLv3-only. See README for year and details.
# Dynamodb module for NixOS. No frills just local ephemeral host.
{ lib, pkgs, config, ... }: {
options.services.dynamodb = {
enable = lib.mkEnableOption "dynamodb";
openFirewall = lib.mkOption {
type = lib.types.bool;
default = false;
};
};
config = let
cfg = config.services.dynamodb;
in lib.mkIf cfg.enable {
systemd.services.dynamodb = {
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
script = ''
exec ${lib.getExe pkgs.dynamodb-local} -dbPath /var/lib/dynamodb
'';
serviceConfig = {
Type = "simple";
User = "dynamodb";
Group = "dynamodb";
};
};
users.users.dynamodb = {
group = "dynamodb";
home = "/var/lib/dynamodb";
useDefaultShell = true;
isSystemUser = true;
createHome = true;
};
users.groups.dynamodb = {};
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [ 8000 ];
};
}