summary refs log tree commit diff
path: root/pkgs/servers/imaginary/default.nix
blob: 8ab50dc957a685c9200ed894841f202fcd4abd27 (plain) (blame)
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
44
45
46
47
48
49
50
51
{ lib
, buildGoModule
, fetchFromGitHub
, fetchpatch
, pkg-config
, vips
}:

buildGoModule rec {
  pname = "imaginary";
  version = "1.2.4";

  src = fetchFromGitHub {
    owner = "h2non";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-oEkFoZMaNNJPMisqpIneeLK/sA23gaTWJ4nqtDHkrwA=";
  };

  patches = [
    # add -return-size flag recommend by Nextcloud
    # https://github.com/h2non/imaginary/pull/382
    (fetchpatch {
      name = "return-width-and-height-of-generated-images.patch";
      url = "https://github.com/h2non/imaginary/commit/cfbf8d724cd326e835dfcb01e7224397c46037d3.patch";
      hash = "sha256-TwZ5WU5g9LXrenpfY52jYsc6KsEt2fjDq7cPz6ILlhA=";
    })
  ];

  vendorHash = "sha256-BluY6Fz4yAKJ/A9aFuPPsgQN9N/5yd8g8rDfIZeYz5U=";

  buildInputs = [ vips ];

  nativeBuildInputs = [ pkg-config ];

  ldflags = [
    "-s"
    "-w"
    "-X main.Version=${version}"
  ];

  __darwinAllowLocalNetworking = true;

  meta = with lib; {
    homepage = "https://fly.io/docs/app-guides/run-a-global-image-service";
    changelog = "https://github.com/h2non/${pname}/releases/tag/v${version}";
    description = "Fast, simple, scalable, Docker-ready HTTP microservice for high-level image processing";
    license = licenses.mit;
    maintainers = with maintainers; [ dotlambda urandom ];
  };
}