2021-11-28 22:26:09 +00:00
|
|
|
{ stdenv, lib, ShellCheck, haskell, pandoc }:
|
2020-03-06 07:48:56 +00:00
|
|
|
|
|
|
|
# this wraps around the haskell package
|
|
|
|
# and puts the documentation into place
|
|
|
|
|
|
|
|
let
|
|
|
|
# TODO: move to lib/ in separate PR
|
|
|
|
overrideMeta = drv: overrideFn:
|
|
|
|
let
|
|
|
|
drv' = if drv ? meta then drv else drv // { meta = {}; };
|
|
|
|
pos = (builtins.unsafeGetAttrPos "pname" drv');
|
|
|
|
meta' = drv'.meta // {
|
|
|
|
# copied from the mkDerivation code
|
|
|
|
position = pos.file + ":" + toString pos.line;
|
|
|
|
};
|
|
|
|
in drv' // { meta = meta' // overrideFn meta'; };
|
|
|
|
|
2021-11-28 22:26:09 +00:00
|
|
|
bin = haskell.lib.compose.justStaticExecutables ShellCheck;
|
2020-03-06 07:48:56 +00:00
|
|
|
|
|
|
|
shellcheck = stdenv.mkDerivation {
|
|
|
|
pname = "shellcheck";
|
|
|
|
version = bin.version;
|
|
|
|
|
2021-12-03 03:25:15 +00:00
|
|
|
inherit (ShellCheck) meta src;
|
2020-03-06 07:48:56 +00:00
|
|
|
|
2020-04-11 06:00:00 +01:00
|
|
|
nativeBuildInputs = [ pandoc ];
|
|
|
|
|
2020-03-06 07:48:56 +00:00
|
|
|
outputs = [ "bin" "man" "doc" "out" ];
|
|
|
|
|
2020-04-11 06:00:00 +01:00
|
|
|
buildPhase = ''
|
|
|
|
pandoc -s -f markdown-smart -t man shellcheck.1.md -o shellcheck.1
|
|
|
|
'';
|
2020-03-06 07:48:56 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -Dm755 ${bin}/bin/shellcheck $bin/bin/shellcheck
|
|
|
|
install -Dm644 README.md $doc/share/shellcheck/README.md
|
|
|
|
install -Dm644 shellcheck.1 $man/share/man/man1/shellcheck.1
|
|
|
|
mkdir $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
overrideMeta shellcheck (old: {
|
|
|
|
maintainers = with lib.maintainers; [ Profpatsch ];
|
|
|
|
outputsToInstall = [ "bin" "man" "doc" ];
|
|
|
|
})
|