From 63adb41f1a060c21a68143eb9e86c2790ef66f36 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 8 Aug 2024 10:45:09 +0200 Subject: ... --- modules/certspotter.nix | 67 ------------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 modules/certspotter.nix (limited to 'modules/certspotter.nix') diff --git a/modules/certspotter.nix b/modules/certspotter.nix deleted file mode 100644 index ff7ff7c2..00000000 --- a/modules/certspotter.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ config, pkgs, lib, ... }: - -with lib; - -let - cfg = config.services.certspotter; - - script = pkgs.writeShellApplication { - name = "certspotter-script"; - runtimeInputs = with pkgs; [ coreutils ]; - text = '' - mkdir -p "''${LOGS_DIRECTORY}" - env > "$(mktemp -p "''${LOGS_DIRECTORY}" "$(date -Iseconds).''${PUBKEY_HASH:-na}.XXXXXXXXXX.env")" - ''; - }; - - startOptions = cfg.extraOptions - ++ optionals (cfg.logs != null) ["-logs" cfg.logs] - ++ ["-watchlist" (pkgs.writeText "watchlist" (concatStringsSep "\n" cfg.watchList)) - "-script" "${script}/bin/certspotter-script" - ]; - - startScript = pkgs.writeShellApplication { - name = "certspotter-start"; - runtimeInputs = [ pkgs.coreutils cfg.package ]; - text = '' - rm -f "''${STATE_DIRECTORY}/lock" - exec -- certspotter -state_dir "''${STATE_DIRECTORY}" ${escapeShellArgs startOptions} - ''; - }; -in { - options = { - services.certspotter = { - watchList = mkOption { - type = types.listOf types.str; - default = []; - }; - - logs = mkOption { - type = types.nullOr types.str; - default = null; - }; - - extraOptions = mkOption { - type = types.listOf types.str; - default = [ "-verbose" ]; - }; - - package = mkPackageOption pkgs "certspotter" {}; - }; - }; - - config = mkIf (cfg.watchList != []) { - systemd.services.certspotter = { - serviceConfig = { - Type = "oneshot"; - ExecStart = "${startScript}/bin/certspotter-start"; - StateDirectory = "certspotter"; - LogsDirectory = "certspotter"; - DynamicUser = true; - - CPUSchedulingPolicy = "idle"; - IOSchedulingClass = "idle"; - }; - }; - }; -} -- cgit v1.2.3