aboutsummaryrefslogtreecommitdiff
path: root/nix/program.mod.nix
diff options
context:
space:
mode:
authoreuxane2025-02-08 22:37:58 +0100
committereuxane2025-02-08 23:34:38 +0100
commit93d00382d3a8f4a89674c60207d6b797bf0d0b99 (patch)
tree28ee526589bb5a542e917d65529bd3f4e7ab2c44 /nix/program.mod.nix
parent79bdab67057eb147bb766762f356778af0d07d99 (diff)
downloadtickwatch-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.nix42
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
8let
9 cfg = config.programs.tickwatch;
10
11in
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}