Parse and serialize rules.json

TL;DR:
- Write FromJSON instances to decode rules.json file
- Prefer Text to String and use the OverloadedStrings language extension
- Read /etc/hosts and append the serialized rules.json to the end

Notes:
- I can remove some of the FromJSON instances and use GHC Generics to define
  them for me.

TODO:
- Define the systemd timer unit for this to run
- Ensure script can run with root privileges
This commit is contained in:
William Carroll 2020-03-29 18:49:45 +01:00
parent 059af12bea
commit 75595b0126
5 changed files with 216 additions and 110 deletions

View file

@ -2,7 +2,11 @@ let
pkgs = import <unstable> {};
in pkgs.mkShell {
buildInputs = with pkgs; [
ghc
haskellPackages.time
(haskellPackages.ghcWithPackages (hpkgs: with hpkgs; [
time
aeson
either
hspec
]))
];
}