about summary refs log blame commit diff
path: root/users/wpcarro/tools/url-blocker/default.nix
blob: ae24aa41b7ca1443acb608f58e3ef7d48b458b6a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
              

   








                                                      
                                                              
                   

                            
                     

                    








                                       
                     


        

    
{ 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