From 18d6842f950fdff04d092c57a77f6237f0a74543 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Fri, 3 Jul 2020 21:33:06 -0400 Subject: [PATCH] package up the regexes better --- default.nix | 4 ++-- docker.nix | 7 ++++--- regexes.dhall | 4 +--- shell.nix | 1 + src/main.rs | 3 ++- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/default.nix b/default.nix index 0aadfad..85042b3 100644 --- a/default.nix +++ b/default.nix @@ -18,7 +18,7 @@ in pkgs.stdenv.mkDerivation { installPhase = '' mkdir -p $out/bin - ln -s ${tron}/bin/tron $out/bin/tron - ln -s ${./regexes.dhall} $out/regexes.dhall + cp ${tron}/bin/tron $out/bin/tron + cp ${./regexes.dhall} $out/regexes.dhall ''; } diff --git a/docker.nix b/docker.nix index d13ef28..04bb67e 100644 --- a/docker.nix +++ b/docker.nix @@ -9,12 +9,13 @@ let dockerImage = pkg: pkgs.dockerTools.buildLayeredImage { name = "xena/tron"; - tag = pkg.version; + tag = tron.version; - contents = [ pkgs.cacert pkg ]; + contents = [ pkgs.cacert ]; config = { - Cmd = [ "/bin/tron" ]; + Cmd = [ "${tron}/bin/tron" ]; + Env = [ "REGEXES=${tron}/regexes.dhall" ]; WorkingDir = "/"; }; }; diff --git a/regexes.dhall b/regexes.dhall index 36fe972..317205f 100644 --- a/regexes.dhall +++ b/regexes.dhall @@ -3,6 +3,4 @@ let Rule = , default = { regex = "", why = "" } } -in [ Rule::{ regex = "(n|z)igg(er|a)", why = "racism" } - , Rule::{ regex = "(hot|cute)", why = "Cadey is testing" } - ] +in [ Rule::{ regex = "(n|z)igg(er|a)", why = "racism" } ] diff --git a/shell.nix b/shell.nix index 9963fb7..f1ef97c 100644 --- a/shell.nix +++ b/shell.nix @@ -9,6 +9,7 @@ pkgs.mkShell { rustc rustfmt + # dhall dhall.dhall-simple # system diff --git a/src/main.rs b/src/main.rs index ac0a4df..d1d3859 100644 --- a/src/main.rs +++ b/src/main.rs @@ -99,9 +99,10 @@ impl FirehoseAdaptor for Rules { #[tokio::main] async fn main() -> Result<()> { - kankyo::init()?; + let _ = kankyo::init(); pretty_env_logger::init(); let cfg: Config = envy::from_env()?; + log::debug!("cfg: {:?}", cfg); let rexes: Vec = serde_dhall::from_file(cfg.regexes.clone()).parse()?; let mut compiled_rules: Vec = Vec::new();