checkmake: fix version information and date of the man page, refactor
This commit is contained in:
parent
2dfbb7c889
commit
76010e75e6
|
@ -1,4 +1,10 @@
|
||||||
{ buildGoModule, fetchFromGitHub, pandoc, lib }:
|
{ lib
|
||||||
|
, buildGoModule
|
||||||
|
, fetchFromGitHub
|
||||||
|
, installShellFiles
|
||||||
|
, pandoc
|
||||||
|
, go
|
||||||
|
}:
|
||||||
|
|
||||||
buildGoModule rec {
|
buildGoModule rec {
|
||||||
pname = "checkmake";
|
pname = "checkmake";
|
||||||
|
@ -8,37 +14,42 @@ buildGoModule rec {
|
||||||
owner = "mrtazz";
|
owner = "mrtazz";
|
||||||
repo = pname;
|
repo = pname;
|
||||||
rev = version;
|
rev = version;
|
||||||
sha256 = "sha256-Ql8XSQA/w7wT9GbmYOM2vG15GVqj9LxOGIu8Wqp9Wao=";
|
hash = "sha256-Ql8XSQA/w7wT9GbmYOM2vG15GVqj9LxOGIu8Wqp9Wao=";
|
||||||
};
|
};
|
||||||
|
|
||||||
vendorSha256 = null;
|
vendorHash = null;
|
||||||
|
|
||||||
nativeBuildInputs = [ pandoc ];
|
nativeBuildInputs = [
|
||||||
|
installShellFiles
|
||||||
|
pandoc
|
||||||
|
];
|
||||||
|
|
||||||
preBuild =
|
ldflags = [
|
||||||
let
|
"-s"
|
||||||
buildVars = {
|
"-w"
|
||||||
version = version;
|
"-X=main.version=${version}"
|
||||||
buildTime = "N/A";
|
"-X=main.buildTime=1970-01-01T00:00:00Z"
|
||||||
builder = "nix";
|
"-X=main.builder=nixpkgs"
|
||||||
goversion = "$(go version | egrep -o 'go[0-9]+[.][^ ]*')";
|
"-X=main.goversion=go${go.version}"
|
||||||
};
|
];
|
||||||
buildVarsFlags = lib.concatStringsSep " " (lib.mapAttrsToList (k: v: "-X main.${k}=${v}") buildVars);
|
|
||||||
in
|
|
||||||
''
|
|
||||||
buildFlagsArray+=("-ldflags=${buildVarsFlags}")
|
|
||||||
'';
|
|
||||||
|
|
||||||
ldflags = [ "-s" "-w" ];
|
postPatch = ''
|
||||||
|
substituteInPlace man/man1/checkmake.1.md \
|
||||||
|
--replace REPLACE_DATE 1970-01-01T00:00:00Z
|
||||||
|
'';
|
||||||
|
|
||||||
|
postBuild = ''
|
||||||
|
pandoc man/man1/checkmake.1.md -st man -o man/man1/checkmake.1
|
||||||
|
'';
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
mkdir -p $out/share/man/man1
|
installManPage man/man1/checkmake.1
|
||||||
pandoc -s -t man -o $out/share/man/man1/checkmake.1 man/man1/checkmake.1.md
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Experimental tool for linting and checking Makefiles";
|
description = "Experimental tool for linting and checking Makefiles";
|
||||||
homepage = "https://github.com/mrtazz/checkmake";
|
homepage = "https://github.com/mrtazz/checkmake";
|
||||||
|
changelog = "https://github.com/mrtazz/checkmake/releases/tag/${src.rev}";
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
maintainers = with maintainers; [ vidbina ];
|
maintainers = with maintainers; [ vidbina ];
|
||||||
longDescription = ''
|
longDescription = ''
|
||||||
|
|
Loading…
Reference in a new issue