nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 coreutils,
6 pkg-config,
7 util-linux,
8 nix-update-script,
9}:
10
11rustPlatform.buildRustPackage (finalAttrs: {
12 pname = "uutils-util-linux";
13 version = "0.0.1-unstable-2026-01-28";
14
15 src = fetchFromGitHub {
16 owner = "uutils";
17 repo = "util-linux";
18 rev = "1f82e16a308c2dd3b5b514153c81df1d4936273d";
19 hash = "sha256-2ZrbzaWZjxlKhrzcOL+N5N2D5818Y2OB+rGfH34pwy4=";
20 };
21
22 postPatch = ''
23 substituteInPlace tests/by-util/test_setsid.rs \
24 --replace-fail "/usr/bin/cat" "${lib.getExe' coreutils "cat"}" \
25 --replace-fail "/usr/bin/true" "${lib.getExe' coreutils "true"}" \
26 --replace-fail "/usr/bin/false" "${lib.getExe' coreutils "false"}"
27 substituteInPlace tests/by-util/test_setpgid.rs \
28 --replace-fail "echo" "${lib.getExe' coreutils "echo"}" \
29 --replace-fail '"cut"' '"${lib.getExe' coreutils "cut"}"'
30 '';
31
32 cargoHash = "sha256-pvfZP6sHfh2kRVYOOTUGPw6Pq6Tsxud8+fU4qTwggcE=";
33
34 nativeBuildInputs = [
35 pkg-config
36 rustPlatform.bindgenHook
37 ];
38
39 buildInputs = [ util-linux ];
40
41 preBuild = ''
42 export NIX_LDFLAGS="$NIX_LDFLAGS -lsmartcols -lmount"
43 '';
44
45 checkFlags = [
46 # Operation not supported
47 "--skip=common::util::tests::test_compare_xattrs"
48 # can't run on sandbox
49 "--skip=test_last::test_display_hostname_last_column"
50 "--skip=test_last::test_last"
51 "--skip=test_last::test_limit_arg"
52 "--skip=test_last::test_since_only_shows_entries_after_time"
53 "--skip=test_last::test_timestamp_format_full"
54 "--skip=test_last::test_timestamp_format_iso"
55 "--skip=test_last::test_timestamp_format_no_time"
56 "--skip=test_last::test_timestamp_format_short"
57 "--skip=test_last::test_until_only_shows_entries_before_time"
58 "--skip=test_lscpu::test_json"
59 "--skip=test_lscpu::test_output"
60 "--skip=test_lslocks::test_column_headers"
61 ];
62
63 passthru.updateScript = nix-update-script {
64 extraArgs = [ "--version=branch" ];
65 };
66
67 meta = {
68 description = "Rust reimplementation of the util-linux project";
69 homepage = "https://github.com/uutils/util-linux";
70 license = lib.licenses.mit;
71 maintainers = with lib.maintainers; [ kyehn ];
72 platforms = lib.platforms.linux;
73 };
74})