srid / leptos-nix-template

Leptos template using Axum+Tailwind+Nix.
MIT License
5 stars 0 forks source link

Figure out nix build #2

Open srid opened 1 year ago

srid commented 1 year ago

This template provides a devShell environment (nix develop), but it doesn't really provide a Nix package (nix build). We should provide one, so that nix run github:srid/leptos-nix-template will directly run this app (production version) on any machine.

https://github.com/srid/leptos-nix-template/blob/09b5b2da34d9efb496fa052be793abfb5cf609a9/flake.nix#L95-L96

@benwis has provided a starting point here https://github.com/leptos-rs/leptos/issues/1152#issuecomment-1616135687

srid commented 1 year ago

I think we can solve this by doing #3 followed by switching to https://trunkrs.dev/

Then we can write a derivation like: https://github.com/OliverEvans96/yew-bevy-nix-flake/blob/cbbf60e7ed96010dc8d74f719da95ba08fd561c3/flake.nix#L29-L48

benwis commented 1 year ago

I think we can solve this by doing #3 followed by switching to https://trunkrs.dev/

Then we can write a derivation like: https://github.com/OliverEvans96/yew-bevy-nix-flake/blob/cbbf60e7ed96010dc8d74f719da95ba08fd561c3/flake.nix#L29-L48

That would probably work. I would also point you to Crane's lovely trunk example. https://github.com/ipetkov/crane/tree/master/examples/trunk

The latest cargo-leptos is in the unstable nix branch, so you could simplify my example even further. I'm spending some time reworking mine over the next few days

srid commented 1 year ago

@benwis Trunk + crane works great!

I have something working right now: https://github.com/srid/leptos-fullstack

Need to figure out SSR next (I'm afraid that might force me to go back to cargo-leptos? Unless cargo-leptos works well with Crane .... does it?)

benwis commented 1 year ago

@benwis Trunk + crane works great!

I have something working right now: https://github.com/srid/leptos-fullstack

Need to figure out SSR next (I'm afraid that might force me to go back to cargo-leptos? Unless cargo-leptos works well with Crane .... does it?)

My example at the top of this thread uses cargo-leptos for SSR, you could use cargo and wasm-pack, but I don't have an example of that in Nix