Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdenv: add uutils-coreutils stdenv #116274

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/7/llvm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ in stdenv.mkDerivation ({

outputs = [ "out" "lib" "dev" "python" ];

nativeBuildInputs = [ cmake python3 ]
nativeBuildInputs = [ cmake python3 python3.pkgs.psutil ]
++ optional enableManpages python3.pkgs.sphinx;

buildInputs = [ libxml2 libffi ]
Expand Down
14 changes: 7 additions & 7 deletions pkgs/development/tools/misc/autoconf/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
# fix stale autom4te cache race condition:
# https://savannah.gnu.org/support/index.php?110521
./2.71-fix-race.patch

./uutils-mkdirp.patch
];

nativeBuildInputs = [ m4 perl ];
Expand All @@ -35,14 +37,13 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;

# Make the Autotest test suite run in parallel.
preCheck =''
preCheck = ''
export TESTSUITEFLAGS="-j$NIX_BUILD_CORES"
'';

meta = {
meta = with lib; {
homepage = "https://www.gnu.org/software/autoconf/";
description = "Part of the GNU Build System";

longDescription = ''
GNU Autoconf is an extensible package of M4 macros that produce
shell scripts to automatically configure software source code
Expand All @@ -52,9 +53,8 @@ stdenv.mkDerivation rec {
file that lists the operating system features that the package
can use, in the form of M4 macro calls.
'';

license = lib.licenses.gpl3Plus;

platforms = lib.platforms.all;
license = licenses.gpl3Plus;
platforms = platforms.all;
maintainers = with maintainers; [ SuperSandro2000 ];
};
}
12 changes: 12 additions & 0 deletions pkgs/development/tools/misc/autoconf/uutils-mkdirp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/lib/autoconf/programs.m4
+++ b/lib/autoconf/programs.m4
@@ -672,7 +672,8 @@
case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #(
'mkdir ('*'coreutils) '* | \
'BusyBox '* | \
- 'mkdir (fileutils) '4.1*)
+ 'mkdir (fileutils) '4.1* | \
+ 'mkdir 0.0.'*)
ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext
break 3;;
esac
32 changes: 25 additions & 7 deletions pkgs/tools/misc/uutils-coreutils/default.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
{ lib
, stdenv
, fetchFromGitHub
, unstableGitUpdater
, rustPlatform
, cargo
, sphinx
, Security
, libiconv
, prefix ? "uutils-"
, withDocs ? true
, sphinx
, withPrefix ? false
, buildMulticallBinary ? true
}:

let
prefix = "uutils-";
in
stdenv.mkDerivation rec {
pname = "uutils-coreutils";
version = "0.0.12";
Expand All @@ -18,16 +23,24 @@ stdenv.mkDerivation rec {
owner = "uutils";
repo = "coreutils";
rev = version;
sha256 = "01zwvadfd570vbsy52svp0vi5r2p873c33vn2h4mr7868myl6q9g";
name = "${pname}-${version}";
sha256 = "sha256-N2CuMkhYFKsvshHXDVqe0itYuS+a9njathBjj3N/RGI=";
};

postPatch = ''
# don't enforce the building of the man page
substituteInPlace GNUmakefile \
--replace 'install: build' 'install:'
'';

cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
name = "${pname}-${version}";
hash = "sha256:19li3gmb5dmrmiiiy9ihr1rl68lz14j2gsgqpjcsn52rkcy17dzh";
hash = "sha256-zuJAVxt3mfw5JBjaulyXNK0Q+geItPF7+JKMZhcT3TU=";
};

nativeBuildInputs = [ rustPlatform.cargoSetupHook sphinx ];
nativeBuildInputs = [ rustPlatform.cargoSetupHook ]
++ lib.optional withDocs sphinx;

buildInputs = lib.optionals stdenv.isDarwin [ Security libiconv ];

Expand All @@ -36,12 +49,17 @@ stdenv.mkDerivation rec {
"PREFIX=${placeholder "out"}"
"PROFILE=release"
"INSTALLDIR_MAN=${placeholder "out"}/share/man/man1"
] ++ lib.optionals (prefix != null) [ "PROG_PREFIX=${prefix}" ]
++ lib.optionals buildMulticallBinary [ "MULTICALL=y" ];
] ++ lib.optionals withPrefix [ "PROG_PREFIX=${prefix}" ]
++ lib.optionals buildMulticallBinary [ "MULTICALL=y" ]
++ lib.optionals (!withDocs) [ "build-coreutils" "build-pkgs" ];

# too many impure/platform-dependent tests
doCheck = false;

passthru.updateScript = unstableGitUpdater {
url = "https://github.com/uutils/coreutils.git";
};

meta = with lib; {
description = "Cross-platform Rust rewrite of the GNU coreutils";
longDescription = ''
Expand Down
40 changes: 36 additions & 4 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,30 @@ with pkgs;
gccStdenvNoLibs = mkStdenvNoLibs gccStdenv;
clangStdenvNoLibs = mkStdenvNoLibs clangStdenv;

stdenvUutilsCoreutils = let
uutils-coreutils = pkgs.uutils-coreutils-minimal;
bintools = wrapBintoolsWith {
bintools = stdenv.cc.bintools.bintools;
coreutils = uutils-coreutils;
};
in stdenv.override {
cc = stdenv.cc.override {
coreutils = uutils-coreutils;
inherit bintools;
};

initialPath = (lib.remove coreutils stdenv.initialPath) ++ [ uutils-coreutils ];
allowedRequisites = lib.mapNullable (rs: (lib.remove [
bintools
bintools.expand-response-params
coreutils
] rs) ++ [
bintools
bintools.expand-response-params
uutils-coreutils
]) (stdenv.allowedRequisites or null);
};

# For convenience, allow callers to get the path to Nixpkgs.
path = config.path;

Expand Down Expand Up @@ -4408,9 +4432,11 @@ with pkgs;

cpcfs = callPackage ../tools/filesystems/cpcfs { };

coreutils = callPackage ../tools/misc/coreutils { };
coreutils-full = coreutils.override { minimal = false; };
coreutils-prefixed = coreutils.override { withPrefix = true; singleBinary = false; };
# By declaring coreutils explicitly we can overwrite it globally without causing infinite loops
coreutils = if stdenv.hostPlatform.useUutilsCoreutils or false then uutils-coreutils else gnu-coreutils;
gnu-coreutils = callPackage ../tools/misc/coreutils { };
coreutils-full = gnu-coreutils.override { minimal = false; };
coreutils-prefixed = gnu-coreutils.override { withPrefix = true; singleBinary = false; };

corkscrew = callPackage ../tools/networking/corkscrew { };

Expand Down Expand Up @@ -4965,6 +4991,10 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) Security;
};

uutils-coreutils-prefixed = pkgs.uutils-coreutils.override { withPrefix = true; };

uutils-coreutils-minimal = pkgs.uutils-coreutils.override { withDocs = false; };

volctl = callPackage ../tools/audio/volctl { };

volk = callPackage ../development/libraries/volk { };
Expand Down Expand Up @@ -5311,7 +5341,9 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) Security;
};

findutils = callPackage ../tools/misc/findutils { };
findutils = callPackage ../tools/misc/findutils {
coreutils = if stdenv.hostPlatform.useUutilsCoreutils or false then uutils-coreutils-minimal else gnu-coreutils;
};

finger_bsd = callPackage ../tools/networking/bsd-finger { };

Expand Down
13 changes: 13 additions & 0 deletions pkgs/top-level/stage.nix
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,19 @@ let
};
};

pkgsUutils = if stdenv.hostPlatform.isLinux then nixpkgsFun {
overlays = [
(self': super': {
pkgsUutils = super';
})
] ++ overlays;
# due to the increased size of the stdenv we need to cheat a bit
crossSystem = stdenv.hostPlatform // {
useUutilsCoreutils = true;
config = "${stdenv.hostPlatform.linuxArch}-pc-linux-gnu";
};
} else throw "Musl libc only supports Linux systems.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: copy&paste "Musl".


# All packages built with the Musl libc. This will override the
# default GNU libc on Linux systems. Non-Linux systems are not
# supported.
Expand Down