-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathdefault.nix
More file actions
43 lines (40 loc) · 1.46 KB
/
default.nix
File metadata and controls
43 lines (40 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
pkgs ? import <nixpkgs> {},
version ? "0.0.0+unknown",
}: let
inherit (pkgs) lib buildGoModule;
goMod = builtins.readFile ./go.mod;
goVersionLine =
let
matches = lib.filter (line: lib.hasPrefix "go " line) (lib.splitString "\n" goMod);
in
if matches == []
then throw "Could not find Go version in go.mod"
else builtins.head matches;
goVersion = lib.removePrefix "go " goVersionLine;
goVersionParts = lib.splitString "." goVersion;
goAttr = "go_${builtins.elemAt goVersionParts 0}_${builtins.elemAt goVersionParts 1}";
go =
lib.attrByPath [goAttr] (throw "Go package attribute ${goAttr} is not available in nixpkgs") pkgs;
in
(buildGoModule.override {inherit go;}) (finalAttrs: {
inherit version;
pname = "clamav-rest";
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.gitTracked ./.;
};
proxyVendor = true;
vendorHash = "sha256-wwPGs9/oI+8DopN+MIWVNwX05D4qQ2pMdWfewil4H8M=";
meta = with lib; {
description = "ClamAV virus/malware scanner with REST API. ";
longDescription = ''
This is a two in one docker image which runs the open source virus scanner
ClamAV (https://www.clamav.net/), performs automatic virus definition updates
as a background process and provides a REST API interface to interact
with the ClamAV process.
'';
homepage = "https://github.com/ajilach/clamav-rest";
license = licenses.mit;
};
})