1{ lib
2, stdenv
3, fetchFromGitHub
4, rustPlatform
5, cargo
6, sphinx
7, Security
8, libiconv
9, prefix ? "uutils-"
10, buildMulticallBinary ? true
11}:
12
13stdenv.mkDerivation rec {
14 pname = "uutils-coreutils";
15 version = "0.0.8";
16
17 src = fetchFromGitHub {
18 owner = "uutils";
19 repo = "coreutils";
20 rev = version;
21 sha256 = "0hx5ypy58d182gxpgs0dxcw03pdgvrcikbhczg6yqpdjjh7163as";
22 };
23
24 cargoDeps = rustPlatform.fetchCargoTarball {
25 inherit src;
26 name = "${pname}-${version}";
27 hash = "sha256:1ynw97dr40yg18jaqgvz3shs0s0j6pvvlkrbka2ganiv8c9fvbyw";
28 };
29
30 nativeBuildInputs = [ rustPlatform.cargoSetupHook sphinx ];
31
32 buildInputs = lib.optionals stdenv.isDarwin [ Security libiconv ];
33
34 makeFlags = [
35 "CARGO=${cargo}/bin/cargo"
36 "PREFIX=${placeholder "out"}"
37 "PROFILE=release"
38 "INSTALLDIR_MAN=${placeholder "out"}/share/man/man1"
39 ] ++ lib.optionals (prefix != null) [ "PROG_PREFIX=${prefix}" ]
40 ++ lib.optionals buildMulticallBinary [ "MULTICALL=y" ];
41
42 # too many impure/platform-dependent tests
43 doCheck = false;
44
45 meta = with lib; {
46 description = "Cross-platform Rust rewrite of the GNU coreutils";
47 longDescription = ''
48 uutils is an attempt at writing universal (as in cross-platform)
49 CLI utils in Rust. This repo is to aggregate the GNU coreutils rewrites.
50 '';
51 homepage = "https://github.com/uutils/coreutils";
52 maintainers = with maintainers; [ siraben SuperSandro2000 ];
53 license = licenses.mit;
54 platforms = platforms.unix;
55 };
56}