Say, is there anyone in my network who knows how #NixFlakes work? I'm struggling getting a nix flake with my nodejs development environment for linux and macos to run quickly on mac. It takes about 1.6 seconds to fire up nix develop
on linux (already too long) but 6.4 seconds on mac.
[#]Nix #NixOS
=> More informations about this toot | More toots from binaryphile@fosstodon.org
@binaryphile could you share the flake? Did you just do nix flake init or use another tool?
=> More informations about this toot | More toots from ahoneybun@hachyderm.io
@ahoneybun Thanks for the interest. I let ChatGPT set it up and then harangued it into functioning. It does function, but as I mentioned, slowness is an issue. It could very well be a nix configuration issue on the Mac, I did the default lix install of nix. The primary issue is that all of the derivation evaluation takes time (nothing is having to build on my machine and they've all been downloaded).
It won't fit in a post so here's a gist:
https://gist.github.com/binaryphile/80e0cb371f47382c5f9c9bb93ef87077
=> More informations about this toot | More toots from binaryphile@fosstodon.org
@binaryphile oof yea it's been running for a few mins on my end (Pop!_OS using Nix Official installer) though I haven't done much with Flakes when it comes to nix develop though (mostly nix-shell).
=> More informations about this toot | More toots from ahoneybun@hachyderm.io
@ahoneybun Thanks so much for trying that. I assume it's taking a while on subsequent runs as well?
=> More informations about this toot | More toots from binaryphile@fosstodon.org
@binaryphile I don't think it ever finished for me, it's just stop on a copying message for me. Did you just run nix develop
in the directory with the flake.nix or something else?
=> More informations about this toot | More toots from ahoneybun@hachyderm.io
@binaryphile ah it did finish:
aaronh@pop-os:~$ nix develop
error (ignored): error: reached end of FramedSource
error:
… while fetching the input 'path:/home/aaronh'
error: file '/home/aaronh/.config/copyq/.copyq_s' has an unsupported type
=> More informations about this toot | More toots from ahoneybun@hachyderm.io
@binaryphile ah if I run it in a nodejs project it is a bit different:
aaronh@pop-os:~/Projects/system76/docs$ nix develop
error: path '/nix/store/rigk4dc51c49yrpxqkz817hnj4g5vadd-source/flake.nix' does not exist
aaronh@pop-os:~/Projects/system76/docs$ ls
archived assets components content flake.nix icons layouts modules node_modules nuxt.config.js package.json package-lock.json pages plugins README.md shell.nix static tailwind.config.js TESTING.md
=> More informations about this toot | More toots from ahoneybun@hachyderm.io
@binaryphile ah right I need to add it to git... duh.
=> More informations about this toot | More toots from ahoneybun@hachyderm.io
@binaryphile it is faster after running it the first time.
=> More informations about this toot | More toots from ahoneybun@hachyderm.io
@ahoneybun Is it closer to 2 seconds or 6 to get to a shell prompt after nix develop?
=> More informations about this toot | More toots from binaryphile@fosstodon.org
@binaryphile looks like 5-6 seconds?
real 0m5.160s
user 0m1.396s
sys 0m0.626s
=> More informations about this toot | More toots from ahoneybun@hachyderm.io
@binaryphile I may base a PR to the system76/docs repo with this as it currently just has a shell.nix file.
=> More informations about this toot | More toots from ahoneybun@hachyderm.io
@ahoneybun Ok, then perhaps it's not just me then. That's a great sanity check. I'll delve deeper on the differences between my linux and mac nix environments and see if I can unearth anything that would soup up the mac side. One difference is that the linux install is a single-user sans daemon, while the mac is multiuser with daemon. ChatGPT has also been hinting at performance issues related to how nix sets up a volume for the nix store on mac.
I'll follow up if I find anything.
=> More informations about this toot | More toots from binaryphile@fosstodon.org
@binaryphile sounds good and glad to be the sanity check haha.
=> More informations about this toot | More toots from ahoneybun@hachyderm.io
@binaryphile nix is not a fast language. It can be frustrating slow at times. See projects like TVIX https://tvl.fyi/blog/rewriting-nix that claims to get to address this problem (still early stages afaik).
You can use direnv to cache the environment so it doesn't have to be evaluated every time. See https://www.danielcorin.com/til/nix/nix-and-direnv-with-flakes/ for example.
=> More informations about this toot | More toots from penguin_brian@hachyderm.io
@penguin_brian Thanks for the link, that was an interesting read. Good to see a similar flake to the one I was using, that means I'm probably not too far off the beaten path.
=> More informations about this toot | More toots from binaryphile@fosstodon.org This content has been proxied by September (ba2dc).Proxy Information
text/gemini