blob: fd691a8755163ebfec058e5c21762ba335dc08bb (
plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
{
description = "Chirp!";
inputs = {
zig.url = "github:mitchellh/zig-overlay";
};
outputs = {
self,
zig,
pkgs,
}: let
nixosModule = {
config,
lib,
pkgs,
...
}: {
options.services.chirp = {
enable = lib.mkEnableOption "Chirp";
port = lib.mkOption {
type = lib.types.port;
default = 8080;
description = "Port to listen on";
};
};
config = lib.mkIf config.services.chirp.enable {
systemd.services.chirp = {
description = "Chirp SystemD Service!";
wantedBy = ["multi-user.target"];
after = ["network.target"];
serviceConfig = {
ExecStart = "${zig.packages.master}";
Restart = "always";
Type = "simple";
DynamicUser = "yes";
};
environment = {
PORT = toString config.services.chirp.port;
};
};
};
};
in {
# TODO: packages.default build
apps.default = {
type = "app";
program = "${zig.packages.${pkgs.system}."0.14.0"} build run";
};
}
// {
nixosModules.default = nixosModule;
};
}
|