1{ stdenv, lib, fetchFromGitHub, bash, coreutils, dtc, file, gawk, gnugrep, gnused, pandoc, which }:
2
3stdenv.mkDerivation rec {
4 pname = "restool";
5 version = "2.4";
6
7 src = fetchFromGitHub {
8 owner = "nxp-qoriq";
9 repo = "restool";
10 rev = "abd2f5b7181db9d03db9e6ccda0194923b73e9a2";
11 sha256 = "sha256-ryTDyqSy39e8Omf7l8lK4mLWr8jccDhMVPldkVGSQVo=";
12 };
13
14 nativeBuildInputs = [ file pandoc ];
15 buildInputs = [ bash coreutils dtc gawk gnugrep gnused which ];
16
17 enableParallelBuilding = true;
18 makeFlags = [
19 "prefix="
20 "bindir_completion=/share/bash-completion/completions"
21 "DESTDIR=$(out)"
22 "VERSION=${version}"
23 ];
24
25 postPatch = ''
26 # -Werror makes this derivation fragile on compiler version upgrades, patch
27 # it out.
28 sed -i /-Werror/d Makefile
29 '';
30
31 preFixup = ''
32 # wrapProgram interacts badly with the ls-main tool, which relies on the
33 # shell's $0 argument to figure out which operation to run (busybox-style
34 # symlinks). Instead, inject the environment directly into the shell
35 # scripts we need to wrap.
36 for tool in ls-append-dpl ls-debug ls-main; do
37 sed -i "1 a export PATH=\"$out/bin:${lib.makeBinPath buildInputs}:\$PATH\"" $out/bin/$tool
38 done
39 '';
40
41 meta = with lib; {
42 description = "DPAA2 Resource Management Tool";
43 longDescription = ''
44 restool is a user space application providing the ability to dynamically
45 create and manage DPAA2 containers and objects from Linux.
46 '';
47 homepage = "https://github.com/nxp-qoriq/restool";
48 license = licenses.bsd3;
49 platforms = platforms.linux;
50 maintainers = with maintainers; [ delroth ];
51 };
52}