From f2906d058f65c40e0b8de2a0153eb429214919bb Mon Sep 17 00:00:00 2001 From: eveeifyeve <88671402+Eveeifyeve@users.noreply.github.com> Date: Tue, 30 Dec 2025 16:48:37 +1100 Subject: [PATCH 1/2] relibc: init at 0.2.5 Co-authored-by: =?UTF-8?q?Anders=20Christiansen=20S=C3=B8rby?= Co-authored-by: Boosted-Bonobo --- pkgs/os-specific/redox-os/default.nix | 19 ++++++ pkgs/os-specific/redox-os/relibc/default.nix | 69 ++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 90 insertions(+) create mode 100644 pkgs/os-specific/redox-os/default.nix create mode 100644 pkgs/os-specific/redox-os/relibc/default.nix diff --git a/pkgs/os-specific/redox-os/default.nix b/pkgs/os-specific/redox-os/default.nix new file mode 100644 index 0000000000000..be7353dedba4d --- /dev/null +++ b/pkgs/os-specific/redox-os/default.nix @@ -0,0 +1,19 @@ +{ + makeScopeWithSplicing', + generateSplicesForMkScope, +}: + +let + otherSplices = generateSplicesForMkScope "redox-os"; +in +makeScopeWithSplicing' { + inherit otherSplices; + f = + self: + let + callPackage = self.callPackage; + in + { + libc = callPackage ./relibc { }; + }; +} diff --git a/pkgs/os-specific/redox-os/relibc/default.nix b/pkgs/os-specific/redox-os/relibc/default.nix new file mode 100644 index 0000000000000..2858e12e06386 --- /dev/null +++ b/pkgs/os-specific/redox-os/relibc/default.nix @@ -0,0 +1,69 @@ +{ + lib, + rustPlatform, + rust-cbindgen, + expect, + stdenv, + fetchFromGitLab, +}: +rustPlatform.buildRustPackage { + pname = "relibc"; + version = "0.2.5"; + + src = fetchFromGitLab { + owner = "redox-os"; + repo = "relibc"; + rev = "0e506e97af6a834386cc424f0cb500866a3d658d"; + hash = "sha256-1+1c0RrjtQqaY1Fy/5MgM5tYvd4Sbj+vxJvdhDzi95Q="; + fetchSubmodules = true; + domain = "gitlab.redox-os.org"; + }; + + cargoHash = "sha256-2NdfPp4ndfE3y+CQ6eTG/gy7HrSDC6QW2C1BiP8uDFI="; + + RUSTC_BOOTSTRAP = 1; + TARGET = stdenv.hostPlatform.rust.rustcTargetSpec; + + # error: Usage of `RUSTC_WORKSPACE_WRAPPER` requires `-Z unstable-options` + auditable = false; + + doCheck = false; + patchPhase = '' + runHook prePatch + + patchShebangs --build renamesyms.sh stripcore.sh + + runHook postPatch + ''; + + buildPhase = '' + runHook preBuild + + make CC=gcc AR=ar LD=ld NM=nm CARGO_COMMON_FLAGS="" all + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out + DESTDIR=$out make CC=gcc AR=ar LD=ld NM=nm install + + runHook postInstall + ''; + + nativeBuildInputs = [ + rust-cbindgen + expect + ]; + + meta = { + homepage = "https://gitlab.redox-os.org/redox-os/relibc"; + description = "C Library in Rust for Redox and Linux"; + license = lib.licenses.mit; + maintainers = [ lib.maintainers.eveeifyeve ]; + platforms = lib.platforms.redox ++ lib.platforms.linux; + teams = [ lib.teams.redox ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a1acb30f79cd0..e541b1f147acb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9845,6 +9845,8 @@ with pkgs; raspberrypifw = callPackage ../os-specific/linux/firmware/raspberrypi { }; raspberrypi-armstubs = callPackage ../os-specific/linux/firmware/raspberrypi/armstubs.nix { }; + redox = recurseIntoAttrs (callPackages ../os-specific/redox-os { }); + rfkill_udev = callPackage ../os-specific/linux/rfkill/udev.nix { }; sgx-sdk = callPackage ../os-specific/linux/sgx/sdk { }; From 861ec3b7960699dd34d79e0def8157e460c01cd5 Mon Sep 17 00:00:00 2001 From: eveeifyeve <88671402+Eveeifyeve@users.noreply.github.com> Date: Wed, 31 Dec 2025 06:07:57 +1100 Subject: [PATCH 2/2] top-level: change to redox.libc --- pkgs/top-level/all-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e541b1f147acb..159b3f00e1312 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7025,7 +7025,7 @@ with pkgs; else if libc == "wasilibc" then wasilibc else if libc == "relibc" then - relibc + redox.libc else if libc == "llvm" then llvmPackages_20.libc else