-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathservice.nix
38 lines (35 loc) · 1021 Bytes
/
service.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
{ pkgs, lib, config, ... }:
let
cfg = config.services.superstar-checkin;
configFile = pkgs.writeTextFile {
name = "config.yml";
text = pkgs.lib.generators.toYAML { } cfg.config;
};
in
{
config = lib.mkIf cfg.enable {
users = {
users.superstar-checkin = {
isSystemUser = true;
createHome = true;
home = "/var/lib/superstar-checkin";
group = "superstar-checkin";
description = "Superstar automatic checkin service";
};
groups.superstar-checkin = {};
};
systemd.services.superstar-checkin = {
description = "Superstar automatic checkin";
path = [ cfg.package ];
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
environment.CONFIG_FILE = configFile;
environment.DATA_DIR = "/var/lib/superstar-checkin";
serviceConfig = {
User = "superstar-checkin";
Group = "superstar-checkin";
ExecStart = "${cfg.package}/bin/superstar-checkin";
};
};
};
}