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
Add Redox OS as a target #93568
Add Redox OS as a target #93568
Conversation
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/redox-nix-was-where-does-the-cc-environment-variable-come-from/7784/9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks nice and unobtrusive to me. Very excited to escape the confines of Unix!
Sweet! I just marked the PR as mergable (no longer a draft) :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diff LGTM
all of the fixup commits could be squashed (at least from my perspective).
not sure what the first commit should be named?
redox: Add as target
if someone could can think of a better commit message, then please prefer that.
If you verified that the contents are correct, then they sha will validate that contents haven't changed. I think that's alright. Edit: format |
I just squashed :-) |
[ ../use-source-date-epoch.patch ./0001-Fix-build-for-glibc-2.31.patch ] | ||
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch | ||
patches = optionals (!stdenv.targetPlatform.isRedox) [ | ||
../use-source-date-epoch.patch ./0001-Fix-build-for-glibc-2.31.patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these patches not apply cleanly on the redox gcc fork, or are already applied there?
We usually try to apply patches unconditionally of the platform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct. Both patches fail to apply to the redox gcc fork
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hesitate to endorse adding a new libc without a clear way to test it, but I think that adding platform definitions early is ok.
Testing could be done with redoxer |
I understand this. I just force-pushed a commit to this PR to remove However, I don't see any harm in keeping relibc, with Redox as the only supported platform. |
@ofborg build relibc |
description = "C Library in Rust for Redox and Linux"; | ||
license = licenses.mit; | ||
maintainers = [ maintainers.aaronjanse ]; | ||
platforms = platforms.redox; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add Linux here if it supports it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, then we can check if it builds on ofborg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that while relibc
supports Linux, that specific precompiled version does not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I try conditionally compiling from source (!stdenv.hostPlatform.isRedox
) for the Linux version? I think that might be good for a separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I think this libc is fine as a placeholder for now, and then you can work further on it at the overlay.
I didn't realize the libc was compatible with Linux, in that case its better to merge relibc with a Linux I see you found |
Inititally, very few, because many packages still need patches |
Looks like @jD91mZM2 is contributor to redox itself. |
Yep. @jD91mZM2 has done some work on packaging Redox, too, including redoxer. Super cool developer, and I've been talking with them to figure out how to make this PR
|
H/t to @boomshroom for helping me find this. While attempting Redox+Nix in the past, they documented their progress and questions on IRC. I stumbled upon those IRC logs while searching the web, and they've been super helpful |
I barely remember making those. In fact I had forgotten before you posted that, and I still didn't remember the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no comments, only congratulations and cheering. Absolutely brilliant work, thank you! 😄
Yeah this looks good I don't wanna wait any longer :). |
I made #93661, #93662, and #93663 for @aaronjanse to hopefully have time to look at. |
lib/systems: Add Redox platform definitions
Motivation for this change
Redox is a Unix-like Operating System written in Rust, aiming to bring the innovations of Rust to a modern microkernel and full set of applications.
Per RFC0046, I hope for Redox to be a tier 5 platform, unsupported and somewhat functional. I'm developing a redoxpkgs overlay (inspired by @ehmry's genodepkgs) to patch packages to work for Redox. With this overlay, I can compile functioning packages such as
binutils
and the Rust cross-compiler. In turn, packages such ashexyl
can be compiled without further modification beyond adding Redox to the package'smeta.plaforms
.I marked this PR as a draft because it contains some changes (see below) that may need to be removed. More specifically, I made a few conditional changes that I couldn't figure out how to do via an overlay.
Note that
relibc
is downloaded precompiled from a filehosting service. It's precompiled because I've tried to compile relibc from source but it crashes during runtime on Redox. It's from a filehosting service because https://static.redox-os.org continually replaces its contents with new versions, breaking the Nix fetch hash. I've contacted Redox maintainers about this; it sounds like https://static.redox-os.org will have pinned versions in the future. I understand if using a third party filehosting service is a blocking security issue.Things done
Things I'd like to keep in this PR:
lib/system
to addx86_64-redox
relibc
, the POSIX C standard library for Redox.Things I'm comfortable removing from this PR if necessary:
slightly modified
gcc6
andrustc
to support Redox (see note above)slightly modified
all-packages.nix
to choose versions of toolchain packages based onisRedox
Tested using sandboxing (nix.useSandbox on NixOS, or option
sandbox
innix.conf
on non-NixOS linux)Built on platform(s)
Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
Tested compilation of all pkgs that depend on this change using
nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
Tested execution of all binary files (usually in
./result/bin/
)Determined the impact on package closure size (by running
nix path-info -S
before and after)Ensured that relevant documentation is up to date
Fits CONTRIBUTING.md.
I think @NixOS/exotic-platform-maintainers would find this PR interesting, so I'll ping them here