diff options
author | Ruben Maher <ruben@maher.fyi> | 2018-08-18 13:41:48 +0930 |
---|---|---|
committer | Ruben Maher <ruben@maher.fyi> | 2018-08-18 15:13:25 +0930 |
commit | 9488b6fd43de9a9274b0dbd36e2758550dd7cad3 (patch) | |
tree | 7d7428c59f8eb50aa036a57974203ff5eda718d9 /tests/clamav.nix | |
parent | 817d84d36d34616ecf1a6ed6cba4fb1327b3a74f (diff) |
ci: store Clamav DB in LFS
Fix #136 (stop pulling the files from @griff's poor server), also add a script
to update the files.
The fun thing about this is that due to sourcing the files from
`https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/raw/master/tests/clamav`
during the tests, updates to the `hashes.json` and `*.cvd` files will always
fail CI. I guess this is a reasonable tradeoff as long as people are aware of
it.
Diffstat (limited to 'tests/clamav.nix')
-rw-r--r-- | tests/clamav.nix | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/clamav.nix b/tests/clamav.nix index 166a5f8..49f3c07 100644 --- a/tests/clamav.nix +++ b/tests/clamav.nix @@ -19,13 +19,17 @@ import <nixpkgs/nixos/tests/make-test.nix> { nodes = { server = { config, pkgs, lib, ... }: let - clamav-db = pkgs.srcOnly { - name = "ClamAV-db"; + clamav-db-files = lib.mapAttrs (name: value: pkgs.stdenv.mkDerivation rec { + inherit name; + src = pkgs.fetchurl { - url = "https://files.griff.name/ClamAV-db.tar"; - sha256 = "eecad99f4c071d216bd91565f84c0d90a1f93e5e3e22d8f3087686ba3bd219e7"; + url = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver/raw/master/tests/clamav/${name}"; + sha256 = value; }; - }; + + unpackPhase = "true"; # don't try to unpack the raw .cvd files + installPhase = "cp $src $out"; + }) (builtins.fromJSON (builtins.readFile ./clamav/hashes.json)); in { imports = [ @@ -53,9 +57,9 @@ import <nixpkgs/nixos/tests/make-test.nix> { ''; script = '' - cp ${clamav-db}/bytecode.cvd /var/lib/clamav/ - cp ${clamav-db}/main.cvd /var/lib/clamav/ - cp ${clamav-db}/daily.cvd /var/lib/clamav/ + cp ${clamav-db-files."bytecode.cvd"} /var/lib/clamav/ + cp ${clamav-db-files."main.cvd"} /var/lib/clamav/ + cp ${clamav-db-files."daily.cvd"} /var/lib/clamav/ chown clamav:clamav /var/lib/clamav/* ''; |