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..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 @@ -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 { };