From 5fb707e61a0eea3b3f855efbd8e1b2e70b85bf5c Mon Sep 17 00:00:00 2001 From: Xavier Vello Date: Sat, 14 Dec 2019 19:04:20 +0100 Subject: [PATCH] Update clamav test to use local fixtures The current version fetches clamav-db-files from gitlab, in the master branch. This is currently broken as the files were removed, and does not allow to ensure a fixture update does not break the test --- tests/clamav.nix | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/clamav.nix b/tests/clamav.nix index 434b196..955d1ac 100644 --- a/tests/clamav.nix +++ b/tests/clamav.nix @@ -19,17 +19,15 @@ import { nodes = { server = { config, pkgs, lib, ... }: let - clamav-db-files = lib.mapAttrs (name: value: pkgs.stdenv.mkDerivation rec { - inherit name; - - src = pkgs.fetchurl { - 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)); + clamav-db-files = pkgs.stdenv.mkDerivation rec { + name = "clamav-db-files"; + src = lib.cleanSource ./clamav; + dontUnpack = true; + installPhase = '' + mkdir $out + cp -R $src/*.cvd $out/ + ''; + }; in { imports = [ @@ -58,9 +56,9 @@ import { ''; script = '' - 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/ + cp ${clamav-db-files}/main.cvd /var/lib/clamav/ + cp ${clamav-db-files}/daily.cvd /var/lib/clamav/ + cp ${clamav-db-files}/bytecode.cvd /var/lib/clamav/ chown clamav:clamav /var/lib/clamav/* '';