Live data from Hacker News

Devenv.sh: Fast and reproducible developer environments using Nix

devenv.sh

111–120 of 171 posts

Re: Devenv.sh: Fast and reproducible developer environments using Nix

#111
post #46

Earlier quoted context omitted.

> I’d love a tool where i can just `cd /tmp/my-hourlong-project` and then `devenv python` to get a python shell that’ll have everything i often use (and probably more) There's a dozen projects that do this. But it would honestly take you as much time to write a shell script to do it as use some other project to do it. Like, seriously: #!/usr/bin/env sh set -eu [ "${DEBUG:-0}" = "1" ] && set -x MY_TEMPLATE="${MY_TEMPL…

I understand this isn't super complex semantically, but even as someone who has used Linux full time on all of my personal desktops/laptops for 10 years now, I don't think I could write shell code like that within an order of magnitude of the time it would take me to google and find a project to do this. Maybe I'm just an outlier, but my perception is that most people don't have instant recall of advanced shell scrip…

When it's more than 2-3 lines of shell script it's better to just use Python (used to be Perl).

Re: Devenv.sh: Fast and reproducible developer environments using Nix

#112
post #14
post #13

Earlier quoted context omitted.

Big drawback of devbox is that you cannot pin packages to specific SHA, which is quite a big limitation when it comes to versitality. I think you can do that on devenv.sh.

The latest version of devbox allows pinning the sha of the nixpkgs repository to whatever you want. We don't yet allow pinning on a per-package basis within nixpkgs, but we're working on that.

This is why I love HN. You ask a random question and the devs working on that project reply to you.

Re: Devenv.sh: Fast and reproducible developer environments using Nix

#113
post #2

Can someone explain to me the advantage of using Nix over containers? What do they offer that are not provided with using docker or other container platform.

Dockerfiles don't compose. If you have two containers and you want to take their union, you are simply out of luck unless you know exactly what you want to take from each one, and you'd better hope they don't interfere with each other. Nix specifications compose perfectly.

Re: Devenv.sh: Fast and reproducible developer environments using Nix

#114
post #102
post #95

Earlier quoted context omitted.

Yeah I found it odd that there is no first class feature for versioning. I wonder what’s the reason, since it’s a pretty obvious need for a package manager.

> Yeah I found it odd that there is no first class feature for versioning. I wonder what’s the reason, since it’s a pretty obvious need for a package manager. Binary package managers need a first-class notion of versioning for install-time dependency resolution, Nix doesn't actually perform install-time dependency resolution. Nixpkgs is a monorepo, and thanks to the way it supports side-by-side installations of confl…

This complicated mess makes me think maybe language models like Codex could be trained to solve any configuration request by learning from trial and error.

Re: Devenv.sh: Fast and reproducible developer environments using Nix

#115
post #37
post #2

Can someone explain to me the advantage of using Nix over containers? What do they offer that are not provided with using docker or other container platform.

One difference is that Docker containers use a separate file system isolated from the host, so you have to separately install your editor/shell in there, mount/clone your dotfiles, etc. With a Nix-based development environment, it can add/override the tools you need, but you get to keep your shell customizations, editor config, etc. Also reproducibility; it can be achieved with containers if you save the artifact (th…

> it will produce a different result than today, and it will likely not even run one year from now

Any way to hack this? Just pretend it's a different date, the pointers to the latest package will changed to reflect that.

Or somehow record the exact versions when you first build the container, and freeze that.

Re: Devenv.sh: Fast and reproducible developer environments using Nix

#116
I still struggle to have the esp32 Cross Compiler Toolchain with the esp-rust llvm Compiler fork working with Nix. Everything without the Esp32 rust Compiler is already in nix pkg.

Also when trying to adopt nix for the enterprise it is still a tough barrier. At least for me struggling how to package something like the synology active backup client nix or how to setup your cups printers in nixos.

Besides that I hope for nix to get secure boot support.

Re: Devenv.sh: Fast and reproducible developer environments using Nix

#117
post #2

Can someone explain to me the advantage of using Nix over containers? What do they offer that are not provided with using docker or other container platform.

I’ve been burned hard by Nix but I’m going to steel man the argument.

- Nix is very good at cross platform support. A single entry-point creates environments on both MacOS and Linux.

- Docker containers run slower on MacOS because the virtualization overhead.

- Docker images can provide a reproducible environment but the images themselves aren’t reproducible.

Re: Devenv.sh: Fast and reproducible developer environments using Nix

#118
post #61

Hi all, I'm the author of https://devenv.sh , https://cachix.org and https://nix.dev . I've been part of the Nix community for more than 10 years and in the last 4 years focused on making it documented, simple and accessible for any developer. After building Cachix (where you can store any software binaries with a few steps) we realized that there needs to be an intuitive interface for crafting developer environments…

I hope this doesn't come off critical - but what does this offer over a flakes-based `devShell` with `nix develop`? The two things that stand out that maybe look slightly easier are the processes section, and the pre-commit hooks sections - but from what I can tell these are generally all solveable via native flakes. Just curious - if this is a valuable tool to add to the arsenal, I'm all for it, but I'm curious what…

It depends a lot from where you are coming from. It seems like you have prior Nix experience:

The main benefit is abstraction using modules: this allows you to extend, compose and abstract your environment. Processes and pre-commit hooks are only the beginning of what's possible.

There's also higher-level CLI interface for building images, sharing environments, etc.

Note that this is only scratching the design surface of what's possible.

Re: Devenv.sh: Fast and reproducible developer environments using Nix

#119

Hi all, I'm the author of https://devenv.sh , https://cachix.org and https://nix.dev . I've been part of the Nix community for more than 10 years and in the last 4 years focused on making it documented, simple and accessible for any developer. After building Cachix (where you can store any software binaries with a few steps) we realized that there needs to be an intuitive interface for crafting developer environments…

Looks great, looking forward to trying it out. I've been mentioning to a work colleague that someone needs to do for the somewhat baroque Nix tools and concepts what Docker did for containers. It just needs a nice porcelain over the top that provides some consistent CLI UX, but lets you dive down deeper as you get more comfortable with the system. As someone who just two weeks ago got into Nix/NixOS via this repo[1]…

I've been hacking on VSCode integration as of yesterday, follow https://github.com/cachix/devenv/issues/26 for updates :)

This shouldn't be more than a day of work.

Re: Devenv.sh: Fast and reproducible developer environments using Nix

#120

Hi all, I'm the author of https://devenv.sh , https://cachix.org and https://nix.dev . I've been part of the Nix community for more than 10 years and in the last 4 years focused on making it documented, simple and accessible for any developer. After building Cachix (where you can store any software binaries with a few steps) we realized that there needs to be an intuitive interface for crafting developer environments…

The nix language basics section of nix.dev finally got me to understand what is actually going on in a derivation file and in my default.nix, so thank you!

You're welcome, that tutorial was written by https://github.com/fricklerhandwerk
Post reply on HN