1{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, libuuid, libselinux
2, e2fsprogs }:
3
4stdenv.mkDerivation rec {
5 pname = "nilfs-utils";
6 version = "2.2.9";
7
8 src = fetchFromGitHub {
9 owner = "nilfs-dev";
10 repo = pname;
11 rev = "v${version}";
12 sha256 = "sha256-XqViUvPj2BHO3bGs9xBO3VpRq9XqnwBptHvMwBOntqo=";
13 };
14
15 nativeBuildInputs = [ autoreconfHook ];
16
17 buildInputs = [ libuuid libselinux ];
18
19 postPatch = ''
20 # Fix up hardcoded paths.
21 substituteInPlace lib/cleaner_exec.c --replace /sbin/ $out/bin/
22 substituteInPlace sbin/mkfs/mkfs.c --replace /sbin/ ${lib.getBin e2fsprogs}/bin/
23 '';
24
25 # According to upstream, libmount should be detected automatically but the
26 # build system fails to do this. This is likely a bug with their build system
27 # hence it is explicitly enabled here.
28 configureFlags = [ "--with-libmount" ];
29
30 installFlags = [
31 "sysconfdir=${placeholder "out"}/etc"
32 "root_sbindir=${placeholder "out"}/sbin"
33 ];
34
35 # FIXME: https://github.com/NixOS/patchelf/pull/98 is in, but stdenv
36 # still doesn't use it
37 #
38 # To make sure patchelf doesn't mistakenly keep the reference via
39 # build directory
40 postInstall = ''
41 find . -name .libs -exec rm -rf -- {} +
42 '';
43
44 meta = with lib; {
45 description = "NILFS utilities";
46 maintainers = [ maintainers.raskin ];
47 platforms = platforms.linux;
48 license = with licenses; [ gpl2 lgpl21 ];
49 downloadPage = "http://nilfs.sourceforge.net/en/download.html";
50 };
51}