about summary refs log tree commit diff
path: root/modules/user/openlab/stackenblocken.nix
blob: 421b64e914edac2f40c846702aab82ae05f677a6 (plain) (blame)
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
{ pkgs, config, lib, ... }:

with lib;

let
  cfg = config.vuizvui.user.openlab.stackenblocken;
  package = lib.getBin pkgs.vuizvui.openlab.stackenblocken.override {
    volumePercent = cfg.volume;
  };

in
{
  options.vuizvui.user.openlab.stackenblocken = {
    enable = mkEnableOption "STACKENBLOCKEN EVERY DAY";

    volume = mkOption {
      description = "Volume in percent";
      default = 50;
      # TODO: replace with types.intBetween https://github.com/NixOS/nixpkgs/pull/27239
      type = types.addCheck types.int (x: x >= 0 && x <= 100);
    };
  };

  config = mkIf cfg.enable {

    systemd.user = {
      services.stackenblocken = {
        description = "stackenblocken timer";
#        wantedBy = [ "default.target" ];
        serviceConfig = {
          ExecStart = "${package}/bin/stackenblocken";
        };
        # everyday at 21:45, except Wednesday (Yoga silence)
        startAt = [ "Mon,Tue,Thu,Fri,Sat,Sun 21:45" "Wed 22:00" ];
      };
    };

  };
}