about summary refs log tree commit diff
path: root/tools/url-blocker/default.nix
blob: 943644e5f54296a21ad592e5e56c0b2c289d0f94 (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
{ pkgs, ... }:

let
  ghc = pkgs.haskellPackages.ghcWithPackages (hpkgs: [
    hpkgs.time
    hpkgs.aeson
    hpkgs.either
  ]);

  # This is the systemd service unit
  service = pkgs.stdenv.mkDerivation {
    name = "url-blocker";
    src = builtins.path { path = ./.; name = "url-blocker"; };
    buildPhase = ''
    ${ghc}/bin/ghc Main.hs
  '';
    installPhase = ''
    mv ./Main $out
  '';
  };

  # This is the systemd timer unit.
  # Run once every minute.
  # Give root privilege.
  systemdUnit = {
    systemd = {
      timers.simple-timer = {
        wantedBy = [ "timers.target" ];
        partOf = [];
      };
    };
  };
in null