News for hackers. Stuff that matters.
Re:Ask HN: What have you built more than twice and wish some... by boplicity on Wednesday January 18, 2023 @10:15AM (#34427620)
A local dev environment that works.

Doing this again, and again, and again....

...truly sucks.

After not working on a codebase for a year, or two, I usually need to set up everything again -- and often run into very stupid/pointless issues that waste an hour, and often much more, just to get to the point where I can start the actual coding process.

This is pretty much why I've stopped coding. I don't have the time to waste any more.

Re:Ask HN: What have you built more than twice and wish some... by miloignis on Wednesday January 18, 2023 @10:30AM (#34427850)
I think local reproducible dev environments is a great and less-intense way to get into Nix (the package manager)! https://devenv.sh/ is built on top of Nix as well to make it more approachable and user friendly for exactly your use case.
Re:Ask HN: What have you built more than twice and wish some... by agent281 on Wednesday January 18, 2023 @11:06AM (#34428460)
I’ve been toying with the idea of using Nix for dev environments at work. What does devenv add on top of Nix?

Edit: And if you know, how does it differ from devbox?

Re:Ask HN: What have you built more than twice and wish some... by miloignis on Wednesday January 18, 2023 @01:05PM (#34430399)
I haven't used devenv or devbox, I've taken the full Nix/NixOS plunge - sorry I can't be more helpful! I've just seen devenv on HN and glanced over its homepage and saw that it was based on Nix but supposed to be easier to use. If you want to jump straight to Nix itself, more power to you! There's a big learning curve, but I have found it very worth it.
Re:Ask HN: What have you built more than twice and wish some... by lrvick on Wednesday January 18, 2023 @11:22AM (#34428737)
I would note that while Nix is very well designed, and may be incredibly useful in untrusted dev environments, it should not be used to compile anything that touches production. Nix got where it is so quickly by mostly ignoring basic supply chain integrity like author package signing. It is always one compromised Github account or single dev workstation away from a massive supply chain attack.

Nix, NPM, Brew, Pip, etc all have basically the same blind trust security posture and should thus not be trusted. I generally suggest Debian in a container for a dual use dev/compile container made of signed/vetted/reproducibly-built dev/build/debug dependencies.

Re:Ask HN: What have you built more than twice and wish some... by jjj123 on Wednesday January 18, 2023 @12:08PM (#34429486)
As someone who knows nothing about package signing and security, are you saying that Nix is about as secure as NPM?
Re:Ask HN: What have you built more than twice and wish some... by lrvick on Wednesday January 18, 2023 @01:46PM (#34431025)
Correct, and that is not a good thing.
Re:Ask HN: What have you built more than twice and wish some... by plasticchris on Wednesday January 18, 2023 @10:18AM (#34427669)
I think containers (docker/vagrant/etc) are probably what you are looking for.
Re:Ask HN: What have you built more than twice and wish some... by boplicity on Wednesday January 18, 2023 @10:31AM (#34427886)
Just the other day I had to figure out an opaque problem with a vagrant image not working. It was very annoying, and wasted the entire time I had set aside for coding.
Re:Ask HN: What have you built more than twice and wish some... by hyeomans on Wednesday January 18, 2023 @10:26AM (#34427795)
Did this happen when you have more than 5 microservices each one with its own database?
Re:Ask HN: What have you built more than twice and wish some... by unwind on Wednesday January 18, 2023 @10:44AM (#34428088)
At a previous employer, there was a basically full-time team member (contractor like me, but long-term presence so it didn't matter much) working with configuration management. It was basically his job to keep the development environment working, and kept reasonably up to date.

That was done using VM images that he owned and maintained, which was not optimal for me, but there was also documentation laying out the steps needed to create the environment so it was possible to maintain a bare-metal clone of the official environment and use that. Good times!

Re:Ask HN: What have you built more than twice and wish some... by dloreto on Wednesday January 18, 2023 @10:45AM (#34428103)
Tools like Devbox: https://github.com/jetpack-io/devbox are making this way easier. Devbox is powered by nix, but it hides all of the complexity and makes it easier to use.
Re:Ask HN: What have you built more than twice and wish some... by lrvick on Wednesday January 18, 2023 @11:11AM (#34428534)
I ship a Dockerfile and Makefile with every single project that contains absolutely everything I need to build, test, and debug that codebase.

I cd to a project and run "make shell" and I am back in a docker container with every tool and the current working directory mounted in it with permissions all mapped 1/1, scripts in path, etc.

The only tools I need on a dev machine are an editor, a browser, a container runtime, and make.

Re:Ask HN: What have you built more than twice and wish some... by MrDresden on Wednesday January 18, 2023 @02:10PM (#34431414)
I have my whole Linux desktop machine, two laptops and a few servers fully codified now in Ansible.

Everything is in there. Every library and piece of software, every config and preference. User creation (minus any sensitive data). Everything.

Made a bootstrap script I run on a fresh install, and then I can push the ansible config onto it from a raspberrypi ansible server on my LAN.

Wanted a different file system in december. Wiped the system, changed filesystems, resetup. Took less than 1 hour.

Re:Ask HN: What have you built more than twice and wish some... by lockyc on Wednesday January 18, 2023 @07:10PM (#34434990)
Isn't this what Microsoft is trying to solve with dev containers? https://containers.dev/
Re:Ask HN: What have you built more than twice and wish some... by teekert on Thursday January 19, 2023 @02:38AM (#34437712)
We had a session here where someone explained how you can use a docker container with VS code to have reproducible local env (for the whole team).

Seem like you never got on board the declarative-infra-as-code boat, it's actually rekindling my software flame, with things like docker-compose and NixOS, everything you ever work on can be stored as code, and set up with 0 effort.