diff --git a/flake.nix b/flake.nix index 3b87f80..10e66c6 100644 --- a/flake.nix +++ b/flake.nix @@ -112,7 +112,6 @@ }; in { inherit (pkgs) - anycast_healthchecker flask-excel iot-data nixfiles-add-secret diff --git a/modules/anycast_healthchecker/default.nix b/modules/anycast_healthchecker/default.nix deleted file mode 100644 index 2683a09..0000000 --- a/modules/anycast_healthchecker/default.nix +++ /dev/null @@ -1,122 +0,0 @@ -{ config, pkgs, lib, ... }: - -with lib; - -let - cfg = config.clerie.anycast_healthchecker; - configFile = pkgs.writeText "anycast-healthchecker.conf" '' - [DEFAULT] - interface = lo - - [daemon] - pidfile = /run/anycast-healthchecker/anycast-healthchecker.pid - ipv4 = true - ipv6 = true - bird_conf = /var/lib/anycast-healthchecker/anycast-prefixes.conf - bird6_conf = /var/lib/anycast-healthchecker/anycast-prefixes6.conf - bird_variable = ACAST_PS_ADVERTISE - bird6_variable = ACAST6_PS_ADVERTISE - bird_reconfigure_cmd = birdc configure - bird6_reconfigure_cmd = birdc configure - dummy_ip_prefix = 10.189.200.255/32 - dummy_ip6_prefix = 2001:db8::1/128 - bird_keep_changes = false - bird6_keep_changes = false - bird_changes_counter = 128 - bird6_changes_counter = 128 - purge_ip_prefixes = false - loglevel = debug - log_maxbytes = 104857600 - log_backups = 8 - json_stdout = false - json_log_file = false - json_log_server = false - ''; - - checksDir = pkgs.writeTextDir "checks.conf" ( - concatStringsSep "\n" ( - mapAttrsToList ( - name: check: '' - [${name}] - ip_prefix = ${check.ip_prefix} - check_cmd = ${check.cmd} - '' + ( - concatStringsSep "\n" ( - optional (check.timeout != null) "check_timeout = ${toString check.timeout}" - ++ optional (check.rise != null) "check_rise = ${toString check.rise}" - ++ optional (check.fail != null) "check_fail = ${toString check.fail}" - ++ optional (check.interval != null) "check_interval = ${toString check.interval}" - ) - ) - ) cfg.checks - ) - ); - - checkOpts = { config, ... }@moduleAttrs: { - - options = { - - enable = mkOption { - type = types.bool; - default = true; - }; - timeout = mkOption { - type = with types; nullOr int; - default = null; - }; - rise = mkOption { - type = with types; nullOr int; - default = null; - }; - fail = mkOption { - type = with types; nullOr int; - default = null; - }; - interval = mkOption { - type = with types; nullOr int; - default = null; - }; - ip_prefix = mkOption { - type = types.str; - }; - cmd = mkOption { - type = types.str; - default = "${pkgs.curl}/bin/curl --fail --silent http://${moduleAttrs.config.ip_prefix}"; - }; - }; - - }; - -in { - - options = { - - clerie.anycast_healthchecker = { - - enable = mkEnableOption "anycast healthchecker"; - - checks = mkOption { - type = with types; attrsOf (submodule checkOpts); - }; - - }; - - }; - - - config = mkIf cfg.enable { - - systemd.services.anycast_healthchecker = { - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - RuntimeDirectory = "anycast-healthchecker"; - StateDirectory = "anycast-healthchecker"; - User = "bird2"; - Group = "bird2"; - ExecStart = "${pkgs.anycast_healthchecker}/bin/anycast-healthchecker -f ${configFile} -d ${checksDir}"; - }; - path = with pkgs; [ bird2 ]; - }; - - }; -} diff --git a/modules/default.nix b/modules/default.nix index 08b5ed4..846bfdf 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -4,7 +4,6 @@ imports = [ ./policyrouting ./akne - ./anycast_healthchecker ./backup ./clerie-firewall ./clerie-gc-dir diff --git a/pkgs/anycast_healthchecker/default.nix b/pkgs/anycast_healthchecker/default.nix deleted file mode 100644 index a0d682b..0000000 --- a/pkgs/anycast_healthchecker/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ buildPythonPackage, fetchPypi, pbr, docopt, python-json-logger }: - -buildPythonPackage rec { - pname = "anycast-healthchecker"; - version = "0.9.1"; - - src = fetchPypi { - inherit pname version; - sha256 = "1d555aa420113c9119f9f548eac35cb4789018b8866535a91f05086727146ea4"; - }; - - buildInputs = [ - pbr - ]; - propagatedBuildInputs = [ - docopt python-json-logger - ]; -} diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix index 52b4146..5ca8e61 100644 --- a/pkgs/overlay.nix +++ b/pkgs/overlay.nix @@ -1,5 +1,4 @@ final: prev: { - anycast_healthchecker = final.python3.pkgs.callPackage ./anycast_healthchecker {}; flask-excel = final.python3.pkgs.callPackage ./flask-excel {}; iot-data = final.python3.pkgs.callPackage ./iot-data {}; nixfiles-add-secret = final.callPackage ./nixfiles/nixfiles-add-secret.nix {};