Add Nix compatible build files.#61
Conversation
|
Hello, thanks for the PR! Have you seen #25? I think it's also doing the same thing there. |
You know, I swear I looked. I'll see if I can see the diff/contribute today. |
|
Haha no worries. Would be nice to get either this PR or the other one in :) |
|
Ok; so I've looked over the other and there's some fundamental differences in how we have packaged it that are somewhat esoteric. I don't want to play me v.s. them, but I will present my reasoning as to my structure and differences.
Cons:
@orhun I'm going to use some skill an an LLM to blatantly copy anything i consider valuable from the other PR to ensure feature parity; I don't intend to compete or disrespect, just contribute. As the developer is there anything you feel such a packaging should be aware of or expose? |
aed3db9 to
999e568
Compare
|
@orhun I have updated my PR with changes, these include support for home-manager and darwin (though I admit I have not fully tested these, and invite contribution on the underlying basis provided. I have also provided some (admitedly LLM generated) documentation on usage. I feel this incorporates the competing branches functionality and provides a clear upstream path. |
|
Can anyone who's well-versed in Nix help reviewing this? |
matthiasbeyer
left a comment
There was a problem hiding this comment.
I think I am in no position to request changes here or approve either.
I have some questions here whether the package could be improved, one nitpick about the Cargo.lock change, but overall this looks good to me.
|
Let me know if this is ready for a final review. I don't have much experience with Nix but I think I can test this locally |
|
So; although I have the changes incorporated into a near working state; the rebuild times have been a real workflow impediment. I'm going to refactor slightly to use 'crane' a tool I've some experience with in the Nix ecosystem that lifts cargo-builds into discrete nix-builds; there's huge caching improvements - and I'm a bit of a perfectionist, bare with me a little. |
Replace Nix-unfriendly ${placeholder "out"} with idiomatic
'''\''' escaping to prevent evaluation-time interpolation
in the bash --run wrapper.
Replace rustPlatform.buildRustPackage with crane's buildDepsOnly + buildPackage pattern. This splits the build into two derivations: - buildDepsOnly: caches ~678 Bevy/transitive crates (keyed on Cargo.lock) - buildPackage: builds only ratty source against cached artifacts Subsequent source-only builds will skip the expensive Bevy compilation.
The triple-single-quotes (''') in Nix evaluate to a literal quote
character, wrapping the bash store path in single quotes and making
it unresolvable at runtime. Use ${placeholder "out"} and ${bash}
directly for clean store path interpolation.
Nix ''…'' strings don't support nesting — the inner ''…'' in the --run block closed the outer postInstall string prematurely, exposing 'in' as bare Nix syntax. Extract the script to a top-level runScript variable and interpolate it via "…" syntax.
Without quotes, the shell splits the multiline runScript into separate arguments. makeWrapper only consumed the first line as --run's value and tried to parse the rest as additional wrapper args (e.g. 'postInstall'). Wrapping in single quotes ensures the entire script is one shell word.
|
I've just taken the opportunity to pull the main branch; the rebuild was somewhat faster than before and worked as expected. As such, I'm considering this ready for merge assuming there are no further suggestions. |
|
thanks @DarthPJB @matthiasbeyer :) |
I am a user of NixOS a nightmarish hellscape of declarative builds and absolute mathematical derivations.
It's a odd place, but for the purposes of easily using your software the inclusion of a flake.nix build-pattern allows me great ease of consumption.
As such, I've added (and will do my best to maintain) the flake.nix required to build under the Nix Package manager; and hopefully wish that you will accept this addition upstream.