e4ddc3ba75
Thanks to the Nix anti-patterns documented here... https://nix.dev/anti-patterns/language.html#reproducability-referencing-top-level-directory-with ...I'm cleaning up some of my Nix expressions. Read the article for more context.
35 lines
669 B
Nix
35 lines
669 B
Nix
{ ... }:
|
|
|
|
let
|
|
pkgs = import <unstable> {};
|
|
|
|
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
|