mononix/Mononix/Nix For Development.md

23 lines
1.8 KiB
Markdown

- multi-language building
- caching intermediate dependencies
- cargo2nix -- probably does what I want, but it is out of date and requires updates for each new version of Rust, unless there is a hidden API to bypass that and build new versions
- crane
- supposedly modern devops is moving more towards Nix? [Taking the pulse of infrastructure management in 2023](https://www.tweag.io/blog/2023-02-23-infrastructure-pulse-2023/)
- most build tools make their own walled gardens (cargo for nix, npm for javascript, maven or ant for Java) and are hostile to any other tool getting involved
- much of Nix has tried to co-exist with these walled gardens, or work outside of them
- rust produces .rlib files, which theoretically should be analogous to .so files, but for Rust only. I feel like these should be build outputs.
- Tried doing some experiments with rustc on the command line. Currently unclear how to include an external crate
```
rustc -o kifu_core.rlib --edition 2021 --crate-type rlib src/lib.rs
rustc -o gtk --edition 2021 -ltokio -L../kifu-core -lgtk -lkifu_core src/main.rs
```
- [[Directly calling rustc]]
- A *lot* of third-party tools depend on the Cargo.toml file. This includes linters, rust-analyzer, and so forth.
- Reasonably good chance that [buildRustCrate](https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/rust.section.md#buildrustcrate-compiling-rust-crates-using-nix-instead-of-cargo-compiling-rust-crates-using-nix-instead-of-cargo) is the ultimate tool for the job in Nix, even though it would require manually setting up each dependency. `crate2Nix` is supposed to convert a Cargo.lock into an appropriate Nix file.
---
- [[Nix should immediately make a person's time better]]
- [[Nix Monorepos]]
- [[Scaling Rust Builds with Bazel]]
- [[Nix Flakes]]
- [[crate2nix]]