1{ lib
2, buildGoModule
3, fetchFromGitHub
4, installShellFiles
5, nix-update-script
6, testers
7, minify
8}:
9
10buildGoModule rec {
11 pname = "minify";
12 version = "2.20.37";
13
14 src = fetchFromGitHub {
15 owner = "tdewolff";
16 repo = pname;
17 rev = "v${version}";
18 hash = "sha256-sBq1RlvyTelPS3gUgucWnyKV93npxvHetB4ezxnhIbU=";
19 };
20
21 vendorHash = "sha256-LT39GYDcFL3hjiYwvbSYjV8hcg0KNgQmLMRWcdz4T48=";
22
23 nativeBuildInputs = [ installShellFiles ];
24
25 ldflags = [ "-s" "-w" "-X main.Version=${version}" ];
26
27 subPackages = [ "cmd/minify" ];
28
29 passthru = {
30 updateScript = nix-update-script { };
31 tests.version = testers.testVersion {
32 inherit version;
33 package = minify;
34 command = "minify --version";
35 };
36 };
37
38 postInstall = ''
39 installShellCompletion --cmd minify --bash cmd/minify/bash_completion
40 '';
41
42 meta = with lib; {
43 description = "Go minifiers for web formats";
44 homepage = "https://go.tacodewolff.nl/minify";
45 downloadPage = "https://github.com/tdewolff/minify";
46 changelog = "https://github.com/tdewolff/minify/releases/tag/v${version}";
47 license = licenses.mit;
48 maintainers = with maintainers; [ gaelreyrol ];
49 mainProgram = "minify";
50 };
51}