diff options
author | euxane | 2025-02-08 22:37:58 +0100 |
---|---|---|
committer | euxane | 2025-02-08 23:34:38 +0100 |
commit | 93d00382d3a8f4a89674c60207d6b797bf0d0b99 (patch) | |
tree | 28ee526589bb5a542e917d65529bd3f4e7ab2c44 /nix/program.mod.nix | |
parent | 79bdab67057eb147bb766762f356778af0d07d99 (diff) | |
download | tickwatch-93d00382d3a8f4a89674c60207d6b797bf0d0b99.tar.gz |
flake: add overlay and NixOS modules for program and service
Diffstat (limited to 'nix/program.mod.nix')
-rw-r--r-- | nix/program.mod.nix | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/nix/program.mod.nix b/nix/program.mod.nix new file mode 100644 index 0000000..ff201eb --- /dev/null +++ b/nix/program.mod.nix | |||
@@ -0,0 +1,42 @@ | |||
1 | { | ||
2 | config, | ||
3 | lib, | ||
4 | pkgs, | ||
5 | ... | ||
6 | }: | ||
7 | |||
8 | let | ||
9 | cfg = config.programs.tickwatch; | ||
10 | |||
11 | in | ||
12 | { | ||
13 | meta = { | ||
14 | maintainers = with lib.maintainers; [ euxane ]; | ||
15 | }; | ||
16 | |||
17 | options = { | ||
18 | programs.tickwatch = { | ||
19 | enable = lib.mkOption { | ||
20 | type = lib.types.bool; | ||
21 | default = false; | ||
22 | description = '' | ||
23 | Whether to add tickwatch to the global environment | ||
24 | and configure a setcap wrapper for it. | ||
25 | ''; | ||
26 | }; | ||
27 | |||
28 | package = lib.mkPackageOption pkgs "tickwatch" { }; | ||
29 | }; | ||
30 | }; | ||
31 | |||
32 | config = lib.mkIf cfg.enable { | ||
33 | environment.systemPackages = [ cfg.package ]; | ||
34 | |||
35 | security.wrappers.tickwatch = { | ||
36 | owner = "root"; | ||
37 | group = "root"; | ||
38 | capabilities = "cap_net_raw+p"; | ||
39 | source = lib.getExe cfg.package; | ||
40 | }; | ||
41 | }; | ||
42 | } | ||