News for hackers. Stuff that matters.
Re:Automate Project Environments with Devbox and Direnv by aerzen on Wednesday July 10, 2024 @03:48AM (#40924589)
This is the way. We should make it a standard practice for oss projects that one is able to git clone, direnv allow and build the project.

Regardless of the distro or even OS. An easy thing to say, but hard to execute on actual projects with patched versions of cPython and some obscure in-house build tool.

Re:Automate Project Environments with Devbox and Direnv by bbarnett on Wednesday July 10, 2024 @05:31AM (#40925169)
As long as it doesn't interfere with supporting normal, non container builds, sure.
Re:Automate Project Environments with Devbox and Direnv by cqqxo4zV46cp on Wednesday July 10, 2024 @05:41AM (#40925224)
What interferes with supporting “normal” builds is the effort required to actually support them. If that was a given, there’d be no justification for us having gotten ourselves in this mess in the first place. The realities of increasingly choose-your-own-adventure nature of Linux have come home to roost, and people are quite rightfully wanting to spend their effort elsewhere.

I say this as someone that was using Gentoo before lxc even existed. So this isn’t code for “I don’t get it”.

Re:Automate Project Environments with Devbox and Direnv by bartekrutkowski on Wednesday July 10, 2024 @06:35AM (#40925528)
What about non Linux operating systems? Those exist and Open Source software written for them, developed on them exists.
Re:Automate Project Environments with Devbox and Direnv by arnorhs on Wednesday July 10, 2024 @08:27AM (#40926141)
I wouldn't put an .envrc file in source control. This seems like an anti-pattern.

I think it should be standard practice that you can pull and run a project without configuring environment variables. I agree with that. The defaults should work.

This is not always possible (when you have something that absolutely relies on a third party thing, which you need an environment variable for) - in which case you should be greeted with a helpful error telling you what environment variables you need to set up and why.

Re:Automate Project Environments with Devbox and Direnv by NoThisIsMe on Wednesday July 10, 2024 @10:20AM (#40927206)
It is absolutely not an anti pattern to check Direnv's `.envrc` in to source control, and if you don't then you're passing up on much of Direnv's value proposition.

Obviously don't put secrets in there. For secrets and overrides you can use separate a `.env` file which is not checked in, and source it in `.envrc` with `dotenv_if_exists`

Re:Automate Project Environments with Devbox and Direnv by pxc on Wednesday July 10, 2024 @10:24AM (#40927251)
You can use direnv in conjunction with sops or your favorite cloud-centric secrets management utility to automate secrets handling without writing any plaintext secrets (or any secrets at all, if you want) to version control.

.envrc is a whole bash script, so it can invoke command line tools that fetch secrets over the network or decrypt them from the disk.

Re:Automate Project Environments with Devbox and Direnv by NoThisIsMe on Wednesday July 10, 2024 @10:43AM (#40927455)
Yep that too
Re:Automate Project Environments with Devbox and Direnv by Fire-Dragon-DoL on Wednesday July 10, 2024 @06:30PM (#40932139)
The moment you commit an envrc file, you disallow the developer from using direnv for that directory to configure stuff related to their machine. It is an anti pattern, it was never meant to be committed. Put an envrc.example in repo if you want, or an envrc.project in there and tell the dev to load it (load_if_exists in direnv)
Re:Automate Project Environments with Devbox and Direnv by drowsspa on Wednesday July 10, 2024 @08:38AM (#40926231)
I would love for an ARCHITECTURE.md to become standard as well... I've definitely skipped contributing to a lot of projects because I'd have to basically have to reverse engineer the project, configuring a dev environment and add a lot of breakpoints to even begin to understand the structure
Re:Automate Project Environments with Devbox and Direnv by crabbone on Wednesday July 10, 2024 @10:08AM (#40927064)
This is an awful idea.

It's very hard to define in general what it means to build a project, what are the expected inputs and outputs. Not every build aims to produce the same artifacts, not using the same inputs etc.

What you want could be based on some typical practice in a particular field with a particular project size or structure, but this doesn't transfer well to other fields.