2020-08-18 13:00:17 +02:00
|
|
|
{ pkgs, ... }:
|
2020-03-29 21:35:34 +02:00
|
|
|
|
|
|
|
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";
|
2020-07-02 14:28:59 +02:00
|
|
|
src = builtins.path { path = ./.; name = "url-blocker"; };
|
2020-03-29 21:35:34 +02:00
|
|
|
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
|