{"id":19442944,"url":"https://github.com/syncom/rust-cross-build-nix","last_synced_at":"2025-04-25T00:32:07.908Z","repository":{"id":58151392,"uuid":"529727350","full_name":"syncom/rust-cross-build-nix","owner":"syncom","description":"Cross building Rust code with Nix in one click","archived":false,"fork":false,"pushed_at":"2025-03-19T23:42:29.000Z","size":60,"stargazers_count":17,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-03T13:39:20.007Z","etag":null,"topics":["nix","reproducible-builds","rust","static-build"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syncom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-28T00:35:57.000Z","updated_at":"2025-01-27T17:56:45.000Z","dependencies_parsed_at":"2023-11-29T00:26:54.910Z","dependency_job_id":"9ad6aba8-a948-471f-a3ed-85e72f983d22","html_url":"https://github.com/syncom/rust-cross-build-nix","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syncom%2Frust-cross-build-nix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syncom%2Frust-cross-build-nix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syncom%2Frust-cross-build-nix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syncom%2Frust-cross-build-nix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syncom","download_url":"https://codeload.github.com/syncom/rust-cross-build-nix/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250733331,"owners_count":21478342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nix","reproducible-builds","rust","static-build"],"created_at":"2024-11-10T15:41:30.687Z","updated_at":"2025-04-25T00:32:07.647Z","avatar_url":"https://github.com/syncom.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reproducible, Statically Linked Rust Cross Builds in Nix\n\n[![cross-rs builds](https://github.com/syncom/rust-cross-build-nix/actions/workflows/r10e-cross-rs-build.yml/badge.svg)](https://github.com/syncom/rust-cross-build-nix/actions/workflows/r10e-cross-rs-build.yml)\n[![rusto-overlay builds](https://github.com/syncom/rust-cross-build-nix/actions/workflows/r10e-rust-overlay-build.yml/badge.svg)](https://github.com/syncom/rust-cross-build-nix/actions/workflows/r10e-rust-overlay-build.yml)\n\nThis repository demonstrates \"one-click\" ways of cross building Rust\ncode, deterministically. We use Nix to do the builds, and the artifacts\nare bit-for-bit reproducible. The examples also statically link against\n`musl` libc, because static linking is trickier to do, and because we\ncan.\n\nYou need Docker for building the examples.\n\n## Approach 1\n\n[nix-cross-rs](./nix-cross-rs/)\n\n- This approach uses [cross-rs/cross](https://github.com/cross-rs/cross),\nmanaged by Nix, for the cross builds. It requires running a container engine\n(`podman`) inside a Docker container, and privileged access permissions.\nCompared to the second approach, this one is less \"pure\" and conceptually more\ncomplex. Hence this approach is less preferred.\n\n## Approach 2\n\n[nix-rust-overlay](./nix-rust-overlay/)\n\n- This approach is \"pure\", in that it uses Nix to manage dependencies entirely.\n- It demonstrates how to statically link to `openssl` for the `unix` target family.\n- It demonstrates cross builds on a `windows` target (without `openssl` static\nlinking, for simplicity).\n\n## How to Build Using Both Approaches\n\nIn the directory root of the repository\n\n```bash\nmake\n```\n\nOr for either approach\n\n```bash\n# Approach 1\nmake cross-rs\n# Approach 2\nmake rust-overlay\n```\n\nClean up with command\n\n```bash\nmake clean\n```\n\nOr for either approach\n\n```bash\n# Approach 1\nmake cr-clean\n# Approach 2\nmake ro-clean\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyncom%2Frust-cross-build-nix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyncom%2Frust-cross-build-nix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyncom%2Frust-cross-build-nix/lists"}