-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
project: move to nixpkgs Rust infrastructure #147
Conversation
ecd749d
to
46b51a4
Compare
This is ready for the initial review phase, final todolist:
|
Once we merge this, we can probably start upstreaming stable versions of Lanzaboote into nixpkgs. |
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.
Looks good, would really love to keep cargp fmt
as a buildable derivation for nix flake check
though.
5ddb719
to
75b14be
Compare
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'd use overrideAttrs
for clippy and rustfmt rather than flags and merging in the main derivation expression. That way they could even live in separate files if you wanted.
nix/packages/stub.nix
Outdated
description = "Lanzaboote UEFI stub for SecureBoot enablement on NixOS systems"; | ||
homepage = "https://github.com/nix-community/lanzaboote"; | ||
license = licenses.mit; | ||
platforms = [ "x86_64-windows" "aarch64-windows" "i686-windows" ]; |
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.
Did we actually get building for aarch64 to work?
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.
error: Package ‘compiler-rt-14.0.6’ in /nix/store/wr7rzhqpb71986npaa2fvbjg302yb3r7-source/pkgs/development/compilers/llvm/14/compiler-rt/default.nix:128 is not available on the requested hostPlatform:
but passing the classical "unsupported systems ok" flag yields you
❯ llvm-objdump --section-headers /nix/store/xfjgpsn98yw3i0bc071zdk4606ij10bg-lanzastub-aarch64-windows-0.3.0/bin/lanzaboote_stub.efi
/nix/store/xfjgpsn98yw3i0bc071zdk4606ij10bg-lanzastub-aarch64-windows-0.3.0/bin/lanzaboote_stub.efi: file format coff-arm64
Sections:
Idx Name Size VMA Type
0 .text 00014770 0000000140001000 TEXT
1 .rdata 000047f0 0000000140016000 DATA
2 .data 00000070 000000014001b000 DATA
3 .reloc 000003a8 000000014001c000 DATA
on a native aarch64 machine
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.
Yes, it wasn't a question whether it would build, but whether it would boot.
Remember the discussion about how aarch64 UEFI is not the same as aarch64 Windows that caused the argument over triples in the first place.
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.
Unfortunately, testing until the end requires some support in systemd which is only on the main branch at the moment.
eed1ee8
to
f95a1fc
Compare
@nikstur can you make it so that the project compiles with all the features? right now we have mutually exclusive features which prevent me from doing |
This is not possible in the current setup because the features are semantically exclusive. If we want to compile with all feature we would need to creare two separate binaries. |
I see, then, no problem, I will find a way :-)
Le sam. 10 juin 2023 à 14:31, nikstur ***@***.***> a écrit :
… @nikstur <https://github.com/nikstur> can you make it so that the project
compiles with all the features? right now we have mutually exclusive
features which prevent me from doing cargo clippy --all-features :-[
This is not possible in the current setup because the features are
semantically exclusive. If we want to compile with all feature we would
need to creare two separate binaries.
—
Reply to this email directly, view it on GitHub
<#147 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACMZRFDAKJDA5ZYBFPARF3XKRSIPANCNFSM6AAAAAAW6MPCMY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This builds the stub and tool using `rustPlatform.buildRustPackage` which features a stable Rust compiler, recent enough to support UEFI targets. In the future, it will rely on properly defined targets for UEFI in nixpkgs.
f95a1fc
to
89b9987
Compare
…n transformer Instead of patching the derivation in-place via flags, we just have a higher order function that takes the Rust package derivation and override it into a Rustfmt / Clippy oriented derivation: it turns off checks and adds its required dependencies.
89b9987
to
b77ef07
Compare
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.
There are a few opportunities to minimize the diff but this is good to go. Thanks for the effort!
config = "${pkgs.hostPlatform.qemuArch}-windows"; | ||
rustc.config = "${pkgs.hostPlatform.qemuArch}-unknown-uefi"; |
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.
config = "${pkgs.hostPlatform.qemuArch}-windows"; | |
rustc.config = "${pkgs.hostPlatform.qemuArch}-unknown-uefi"; | |
config = "${pkgs.stdenv.hostPlatform.qemuArch}-windows"; | |
rustc.config = "${pkgs.stdenv.hostPlatform.qemuArch}-unknown-uefi"; |
error: attribute 'hostPlatform' missing
at /nix/store/k7h8k8whqw64rmsg6yhkmmdc82lkczc6-source/flake.nix:66:27:
65| # linuxArch is wrong here, it will yield arm64 instead of aarch64.
66| config = "${pkgs.hostPlatform.qemuArch}-windows";
| ^
67| rustc.config = "${pkgs.hostPlatform.qemuArch}-unknown-uefi";
Did you mean rustPlatform?
Going to test this and create a 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.
see #198
This builds the stub and tool using
rustPlatform.buildRustPackage
which features a stable Rust compiler, recent enough to support UEFI targets.In the future, it will rely on properly defined targets for UEFI in nixpkgs.: we won't need it.For now, this PR is broken and depends on various changes in nixpkgs upstream for proper "cross compilation" support for UEFI targets, see NixOS/nixpkgs#226145 for example.Closes #98.