3 ms·
I would rather have a Nix devShell.
by toastal 4y ago
I would rather have a Nix devShell.
- viraptor 4y agoIs there a good solution for devshell with associated services? The app itself is fine that way, but what about the database, message queue, seed data, etc.?
- _hl_ 4y agoI usually write a script that idempotently spins these things up locally, and use the shellHook to call that script. That way whenever I cd into the dir the first time, direnv loads the nix-shell, which starts the db, message broker, etc. I also have a shutdown script that I run when I manually want to shut things down. Works quite well. For more advanced use cases, such as k8s with tons of services, you're better off using something like tilt.dev.
- qbasic_forever 4y agoYou can install any services in your nix dev shell environment. Run them however you desire--a bash script that backgrounds their tasks, systemd user services, supervisord, or any other process manager. edit: A really simple and effective process manager is foreman and its procfile format. I like the golang version of it (simple single binary with zero dependencies): https://github.com/ddollar/forego https://github.com/ddollar/forego or https://github.com/mattn/goreman https://github.com/mattn/goreman
- viraptor 4y agoSo I'm aware you can script anything you want. I meant a more integrated version. Now I'm tempted to write one myself where you provide the (for example) mysql you want to run and it automatically inserts the right scripts...
- thenonameguy 4y agoI've been using https://github.com/F1bonacc1/process-compose https://github.com/F1bonacc1/process-compose with great success. It's a userspace process orchestrator/scheduler that works across all relevant platforms, supporting daemon processes and k8s style readiness/health checks. In combination with nix flakes, it quickly reduced my projects docker-compose usage for easy-to-configure services. This gave huge performance benefits for the M1 Mac folks on my team especially for CPU intensive processes thanks to native binaries. For maximal ease of use, the remaining docker-compose containers are started/stopped as a process-compose task. Quite meta :)
- evol262 4y agoI would, too, but the barrier to entry is much higher. This has been discussed ad-nauseum, but "getting started" with nix (or home-manager, or devshell) is an experience worse than trying to do anything with Linux in 2005. Cobbling together a bunch of blogposts and docs which kind of, sort of, might let you piece together a config which works after enough iterations and unreadable backtraces is far more difficult than it needs to be, and that's before you get into cases like "I want Python linters in my environment, so I need Python, but I also need access to some modules from Python on the system, which aren't installable (let's say `python-apt`, which cannot be installed from pypi), and..." For probably the 500th time someone has said it on HN this week, nix will never be really usable or gain wider adoption until someone puts together solid documentation, or even a solid "getting started -- intermediate" guide which can bridge between "let me set up a trivial env" and "I'm running nixos and it's nix all the way down"