From 0037227ca67692e6beb294dd67bc54f206745dd7 Mon Sep 17 00:00:00 2001 From: Diego Restrepo Date: Mon, 20 Feb 2023 12:23:32 -0500 Subject: [PATCH] refac(back): #1007 redefine cache module - make the cache module generic - add priority to use the different caches - add cache server type - by default the server only read the cache, it must be specified that the cache is also written --- .mailmap | 1 + src/evaluator/modules/cache/default.nix | 40 +++++++++++++++---------- src/evaluator/modules/default.nix | 1 + 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.mailmap b/.mailmap index 8af8430d..eaee2f81 100644 --- a/.mailmap +++ b/.mailmap @@ -7,6 +7,7 @@ David Acevedo David Acevedo David Arnold David Arnold David Arnold David Arnold Diego Restrepo Diego Restrepo Mesa <36453706+drestrepom@users.noreply.github.com> +Diego Restrepo Diego Restrepo Diego Restrepo Diego Restrepo Mesa <36453706+drestrepom@users.noreply.github.com> Fluid Attacks Fluid Attacks Github Dependabot <49699333+dependabot[bot]@users.noreply.github.com> dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> diff --git a/src/evaluator/modules/cache/default.nix b/src/evaluator/modules/cache/default.nix index 60429ec4..76a1dcd0 100644 --- a/src/evaluator/modules/cache/default.nix +++ b/src/evaluator/modules/cache/default.nix @@ -5,28 +5,38 @@ }: { options = { cache = { - readAndWrite = { - enable = lib.mkOption { - default = false; - type = lib.types.bool; - }; - name = lib.mkOption { - type = lib.types.str; - }; - pubKey = lib.mkOption { - type = lib.types.str; - }; - }; - readExtra = lib.mkOption { - default = []; - type = lib.types.listOf (lib.types.submodule (_: { + extra = lib.mkOption { + default = {}; + type = lib.types.attrsOf (lib.types.submodule (_: { options = { + enable = lib.mkOption { + default = false; + type = lib.types.bool; + }; + name = lib.mkOption { + type = lib.types.str; + }; + token = lib.mkOption { + type = lib.types.str; + default = ""; + }; + priority = lib.mkOption { + type = lib.types.int; + }; pubKey = lib.mkOption { + default = ""; type = lib.types.str; }; + type = lib.mkOption { + type = lib.types.enum ["cachix" "attic"]; + }; url = lib.mkOption { type = lib.types.str; }; + write = lib.mkOption { + default = false; + type = lib.types.bool; + }; }; })); }; diff --git a/src/evaluator/modules/default.nix b/src/evaluator/modules/default.nix index 21a39e68..a753d332 100644 --- a/src/evaluator/modules/default.nix +++ b/src/evaluator/modules/default.nix @@ -10,6 +10,7 @@ } @ args: { imports = [ (import ./cache/default.nix args) + (import ./cache-with-attic/default.nix args) (import ./calculate-scorecard/default.nix args) (import ./compute-on-aws-batch/default.nix args) (import ./dev/default.nix args)