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 nix flake #261
add nix flake #261
Conversation
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.
Thanks for your contribution! You are to making eunomia-bpf even better.
Hi, Thanks for your contributions! |
Any progress on this pr?Is it ready for review? |
flake: complete eunomia-bpf reproducible build This commit brings: - Fix issue mentioned in 158 - Update way of building ecli to adapt code changes - Add dev env with full eunomia-bpf toolchain flake: add pre-commit-hooks This commit adds pre commit check based on nix flake. chore: apply suggestions from flake check - Apply format suggestion from black - Rename file with space-separated names, which is not recommend on unix system flake: add wasm-bpf cli to dev env flake: devShell subdivision flake: sync bpftool to wasm-bpftool branch doc: fix display error in README flake: fetch vmlinux chore: update deprecated lock flake: adapt code changes on master flake: add missing include flake: add apps fix: cargo lock mismatch Previous version of Cargo.lock show `error: no matching package named bpf-oci found`. fix: nix build ecli flake: fix bpftool version
flake.nix
Outdated
nativeBuildInputs = with pkgs; [ | ||
pkg-config | ||
zlib.static | ||
elfutils | ||
zlib | ||
openssl.dev | ||
cargo | ||
rustc | ||
rustPlatform.cargoSetupHook | ||
rustPlatform.bindgenHook | ||
]; |
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.
openssl, elfutils and zlib should belong to buildInputs.
flake.nix
Outdated
installPhase = '' | ||
mkdir -p $out/bin | ||
install -Dm 755 target/release/ecli-rs $out/bin/ | ||
install -Dm 755 target/release/ecli-server $out/bin/ | ||
''; |
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.
Don't forget the runHook.
flake.nix
Outdated
installPhase = '' | ||
mkdir -p $out/bin | ||
cp $src/bin/ecli-server $out/bin/ecli-server | ||
''; |
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.
runHook
flake.nix
Outdated
buildPhase = '' | ||
cd compiler/cmd | ||
export OUT_DIR=. | ||
cargo build --release | ||
''; | ||
installPhase = '' | ||
mkdir -p $out/bin | ||
chmod +x target/release/ecc-rs | ||
cp target/release/ecc-rs $out/bin/ecc | ||
''; |
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.
runHook
I clicked approve by mistake, please ignore it. Thanks for your contribution. |
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.
LGTM now, wait for ci tests.
Before merging, some conflicts need to be resolved. @oluceps could you help with this? |
Pull Request Template
Description
This pull request adds flake.nix, to simplify packaging process.
Use
nix bundle --bundler github:ralismark/nix-appimage .#ecli-rs
,nix bundle --bundler github:ralismark/nix-appimage .#ecli-server
to create a static linked AppImage file.NOTE: this requires
ecli/Cargo.lock
exists and added into git tree (git add ecli/Cargo.lock -f
), but no need to commit it.P.S: According to Cargo Book, "If you’re building an end product, which are executable like command-line tool or an application, or a system library with crate-type of staticlib or cdylib, check Cargo.lock into git."
I've tested that
nix bundle --bundler github:NixOS/bundlers#toDockerImage .#ecli-rs
also works well, producing a ~27M docker image.See also: #258
Type of change
New feature (non-breaking change which adds functionality)
How Has This Been Tested?
N/A
Checklist