1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 meson,
6 ninja,
7 pkg-config,
8 asciidoctor,
9 iniparser,
10 json_c,
11 keyutils,
12 kmod,
13 udev,
14 util-linux,
15 libtracefs,
16 libtraceevent,
17}:
18
19stdenv.mkDerivation (finalAttrs: {
20 pname = "libndctl";
21 version = "82";
22
23 src = fetchFromGitHub {
24 owner = "pmem";
25 repo = "ndctl";
26 tag = "v${finalAttrs.version}";
27 hash = "sha256-zTIYGKUVIINeSisSCghImfjtJLdecQGL2i6ftxf8QXc=";
28 };
29
30 patches = lib.optionals (!stdenv.hostPlatform.isGnu) [
31 # Use POSIX basename on non-glib.
32 # Remove when https://github.com/pmem/ndctl/pull/263
33 # or equivalent fix is merged and released.
34 ./musl-compat.patch
35 ];
36
37 outputs = [
38 "out"
39 "man"
40 "dev"
41 ];
42
43 nativeBuildInputs = [
44 meson
45 ninja
46 pkg-config
47 asciidoctor
48 ];
49
50 buildInputs = [
51 iniparser
52 json_c
53 keyutils
54 kmod
55 udev
56 util-linux
57 libtracefs
58 libtraceevent
59 ];
60
61 mesonFlags = [
62 (lib.mesonOption "rootprefix" "${placeholder "out"}")
63 (lib.mesonOption "sysconfdir" "${placeholder "out"}/etc/ndctl.conf.d")
64 # Use asciidoctor due to xmlto errors
65 (lib.mesonEnable "asciidoctor" true)
66 (lib.mesonEnable "systemd" false)
67 (lib.mesonOption "iniparserdir" "${iniparser}")
68 ];
69
70 postPatch = ''
71 patchShebangs test
72
73 substituteInPlace git-version --replace-fail /bin/bash ${stdenv.shell}
74 substituteInPlace git-version-gen --replace-fail /bin/sh ${stdenv.shell}
75
76 echo "m4_define([GIT_VERSION], [${finalAttrs.version}])" > version.m4;
77 '';
78
79 meta = {
80 description = "Tools for managing the Linux Non-Volatile Memory Device sub-system";
81 homepage = "https://github.com/pmem/ndctl";
82 license = lib.licenses.lgpl21;
83 maintainers = with lib.maintainers; [ thoughtpolice ];
84 platforms = lib.platforms.linux;
85 };
86})