nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 fetchpatch,
6 pkg-config,
7 vips,
8}:
9
10buildGoModule rec {
11 pname = "imaginary";
12 version = "1.2.4";
13
14 src = fetchFromGitHub {
15 owner = "h2non";
16 repo = "imaginary";
17 rev = "v${version}";
18 hash = "sha256-oEkFoZMaNNJPMisqpIneeLK/sA23gaTWJ4nqtDHkrwA=";
19 };
20
21 patches = [
22 # add -return-size flag recommend by Nextcloud
23 # https://github.com/h2non/imaginary/pull/382
24 (fetchpatch {
25 name = "return-width-and-height-of-generated-images.patch";
26 url = "https://github.com/h2non/imaginary/commit/cfbf8d724cd326e835dfcb01e7224397c46037d3.patch";
27 hash = "sha256-TwZ5WU5g9LXrenpfY52jYsc6KsEt2fjDq7cPz6ILlhA=";
28 })
29 ];
30
31 vendorHash = "sha256-BluY6Fz4yAKJ/A9aFuPPsgQN9N/5yd8g8rDfIZeYz5U=";
32
33 buildInputs = [ vips ];
34
35 nativeBuildInputs = [ pkg-config ];
36
37 ldflags = [
38 "-s"
39 "-w"
40 "-X main.Version=${version}"
41 ];
42
43 __darwinAllowLocalNetworking = true;
44
45 meta = {
46 homepage = "https://fly.io/docs/app-guides/run-a-global-image-service";
47 changelog = "https://github.com/h2non/imaginary/releases/tag/v${version}";
48 description = "Fast, simple, scalable, Docker-ready HTTP microservice for high-level image processing";
49 license = lib.licenses.mit;
50 maintainers = with lib.maintainers; [
51 dotlambda
52 ];
53 mainProgram = "imaginary";
54 };
55}