1{ buildGoModule, fetchFromGitHub, pandoc, lib }:
2
3buildGoModule rec {
4 pname = "checkmake";
5 version = "0.2.1";
6
7 src = fetchFromGitHub {
8 owner = "mrtazz";
9 repo = pname;
10 rev = version;
11 sha256 = "sha256-Zkrr1BrP8ktRGf6EYhDpz3oTnX6msrSpfFqkqi9pmlc=";
12 };
13
14 vendorSha256 = null;
15
16 nativeBuildInputs = [ pandoc ];
17
18 preBuild =
19 let
20 buildVars = {
21 version = version;
22 buildTime = "N/A";
23 builder = "nix";
24 goversion = "$(go version | egrep -o 'go[0-9]+[.][^ ]*')";
25 };
26 buildVarsFlags = lib.concatStringsSep " " (lib.mapAttrsToList (k: v: "-X main.${k}=${v}") buildVars);
27 in
28 ''
29 buildFlagsArray+=("-ldflags=${buildVarsFlags}")
30 '';
31
32 ldflags = [ "-s" "-w" ];
33
34 postInstall = ''
35 mkdir -p $out/share/man/man1
36 pandoc -s -t man -o $out/share/man/man1/checkmake.1 man/man1/checkmake.1.md
37 '';
38
39 meta = with lib; {
40 description = "Experimental tool for linting and checking Makefiles";
41 homepage = "https://github.com/mrtazz/checkmake";
42 license = licenses.mit;
43 maintainers = with maintainers; [ vidbina ];
44 platforms = platforms.linux;
45 longDescription = ''
46 checkmake is an experimental tool for linting and checking
47 Makefiles. It may not do what you want it to.
48 '';
49 };
50}