511 points · by tosh · 4y ago · 300 comments
For me, it has come so far that I don't have any interpreters or compilers in my main OS environment and even for one off REPL sessions, I'll use `nix shell nixpkgs#python3 -c python3`.
[0]: https://nixos.org/
Be prepared to sink dozens and dozens of hours learning the language, it’s features, and switching everything over. Be prepared to get stuck when you are required to use an old version of a language and things don’t install correctly — and sometimes blocked by nix itself from installing it. Be prepared to get stuck if you are not in the happy path. Be prepared to get lost in the sometimes scant documentation.
I love the idea of nix, but it did not work for me except for the simplest cases.
Like you, I find Nix hard to use and the docs confusing (beyond trivial examples). The amount of time the Nix mafia spends proselyting could be better spent making better docs
But it's no wonder that people keep commenting that Nix is an awesome idea that solves a lot of problems. That's because it's an awesome idea that solves a lot of problems (yeah, like Rust).
It is also completely undiscoverable (not completely unlike Rust), and that's why almost nobody uses it. But that's a matter of improving the documentation or maybe fixing one or two superficial problems on the language.
The reality is that the docs are fine. The reference material is comprehensive, and there are some very good tutorials and introductory essays to get people started. The problem is that it's difficult. Nix is very, very different from what people already know, and it takes quite a bit of effort to learn how it works. Most people just aren't prepared to do that much work just to install some software.
Nix provides a level of flexibility that other solutions simply do not offer. If a package in Nix doesn't fit your requirements for whatever reasons, you can create a modified version of a package with ease. For example, say that you need a version of Nginx built against a custom version of OpenSSL. You can do just that with a few lines of code:
let
mypatch = pkgs.fetchpatch {
url = "https://example.com/bugfix-for-openssl.patch";
sha256 = "...";
};
openssl = pkgs.openssl.overrideAttrs (old: {
# add build flags
configureFlags = old.configureFlags ++ [ "--enable-foo" ];
# add dependencies
buildInputs = old.buildInputs ++ [ pkgs.foo ];
# add patches
patches = old.patches ++ [ mypatch ];
});
in
nginx.override { inherit openssl; }
Nix will even know which packages it'd need to build locally instead of downloading a prebuilt binary.You can't do that with other common package managers. You're stuck with whatever the package manager provides you. So if you're not in the happy path, you're out of luck. You'd either have to give up or build from scratch. If you need a bugfix for a particular package, you'd have wait until the fix reaches the package repository. When I was using Ubuntu, that was often until the next major release. None of this stuff is a problem with Nix, which allows for customization with very little effort.
It's easy to learn about Nix if you know where to look for. Nix Pills [1] would be a good start. The core language is the easiest part. It's JSON, but with functions and variables for proper abstraction. The documentation, while imperfect, is quite extensive compared to a majority of other high profile open source projects. If the documentation fails you, the Nixpkgs repository [2] is an even more rich source of information. The code is well organized, and I was able to get familiar with writing Nix packages fairly quickly by grepping the codebase. And finally, Nix has a sizable community so you could always ask if you're stuck.
I understand you are saying it with the best intentions but it might sound like not the most correct way of defending a tool being criticized for its lack of documentation or easy of use.
Here's the simplest example of an utter failure when I tried nix: installing ruby 2.2. It's very possible I did something totally wrong, but when I have to use ruby 2.2 and nix cannot do it, it sort of kills your awesome example of being able to override openssl.
Another extremely frustrating experience was the bifurcation between nix and nixos. Clearly one experience is preferred over the other. So many blogs and docs talk about things like HomeManager and other configurations that are nixos specific.
On top of nixos/nix, there's also shell.nix/flakes. There's just too much development in nix right now to make sense of what's going on.
I've been using nix as my daily OS for six months and I'm able to be productive. At the same time, I'm often confused as to whether I should use nix-shell, nix-env or modify my configuration files.
Thanks for the great comment.
Also rollbacks in nixos are amazing.
On the other hand newly packaging something can be really daunting.
I also feel like nix is immediately tangible and beneficial in a way that makes us want to get to the power user level, but I don't feel like wanting to learn, say, kubernetes means one automatically wants to learn to be a cluster operator. The scope and complexity are great, and I have experienced all of the things you have described as well. Now that I am fairly confident in my abilities, I think it's important to make sure we find ways to help everyone get the most out of it, even if it doesn't involve scaling the wall that is the learning curve.
Can you clarity what you mean?
What do you mean by "trap"? Which (if any) of the following concepts factor into your understanding? Broken expectations? Premature optimization? Over-engineering? Lock-in?
Are you suggesting that many users of the Nix package manager "fall into a trap" and begin using NixOS?
What do surveys and/or data show about usage of just the Nix package manager? Combined with NixOS?
Thanks to a chatty Romanian taxi driver I had earlier today, I understand this.
I recently gave nix a try because of a hacker news comment and agree with most of the points in this comment. The fact that new users are encouraged to read not 1, but 3 separate manuals to grok the tool is extremely discouraging for new users. Also the fact that nix is currently transitioning to a new feature called flakes and deprecating channels signals to me that the ecosystem is not stable enough for me to recommend that my team at work use it right now.
That being said, I intend to read at least 2 of the manuals and use nix for dependency management in my side projects and to manage my system dependencies. I think nix takes all the great things that asdf can do, to a whole new level. The dream of having a nix section in my projects 'Getting Started' that only has 2 steps (1. Install nix 2. Run `nix-shell`) is something I desperately want.
I think nix is much like erlang in that it's incredibly powerful and solves a lot of common problems, but it's used and maintained by an old guard that went through the trouble of learning how to use it and maintains the "I did it, why can't you" mindset. The erlang ecosystem has been given new life and been made easily available to new users thanks to the awesome work done by Jose Valim and the rest of the elixir team and community. However, I really hope that it doesn't take 30 years and a new language built on top of nix for it to become accessible to everyone.
For those working on nix and the new flake functionality please look to things like elixir and asdf for inspiration on documentation, ease of use and pragmatism. Help make the tool you love ubiquitous. It will ultimately make your life easier when working with new developers because they will already have nix installed.
I intended to do everything I can to help push nix in this direction (once I understand how the hell it works) if anyone reading this, has some time on their hands and wants to improve the state of software development for everyone please go down the nix rabbit hole and try to find ways to contribute to making it more accessible.
I've found it to be quite flexible though. For example, here's a commit in which I apply a patch to a tool to solve a problem that the derivation hadn't taken into account (and absent a home-manager solution): https://github.com/samhh/dotfiles/commit/867dd3b4d4b3942a0aa...
I understand everything in that sentence except the word "so".
Really, I like the idea and I actually like the fact that they use Guile (scheme) instead of a home-built DSL, but guix is a horrible, poorly documented, doesn't work even on the happy path mess.
But maybe I'm just a "GNU zealot".
Look at Python with Nix: https://nixos.wiki/wiki/Python And then consider the simplicity of `pyenv install x.x.x` and a requirements.txt.
"possible future efficiency gains".
- you want to use lang-x.y.z, so you'll just reference an old commit
- turns out that version was never packaged, so you copy x.y.z-1 to your flake/overlay
- you end up patching the build because it doesn't work by default with new environments
- on the other hand a module you're using needs the new environment so you do your best to make everything happy - more overlaying
- because you changed something crucial in a few steps, you're compiling llvm 20 times through this process and now it's 1am
Compare that to putting "rust 1.59" in your .tool-version and running "asdf install". Guess who tried to use 3 specific versions of rust at the same time recently and got very familiar with the process...
(That's also ignoring the issue like Ruby being packaged without the platform identifier in nix which makes it unusable for some development purposes)
As others pointed, the idea behind nix is cool, but it sometimes fall short, hope it get ironed all the issues in macOS so I could give a try in the future.
nix-shell -p bundlerhttps://lists.gnu.org/archive/html/guix-devel/2022-03/msg001...
Mostly I think Nix would be just as hard if packages were expressed in any language.
Stuff like "this program compiled by nix is using a different glibc than this library" is going to be confusing regardless of whether Nix expressions can be written with JavaScript; or stuff like some program assumes it can write to $HOME in its build script not playing nicely with Nix.
A lot of why Nix is hard is because it's weird, and that even as an end user when things go wrong it may require understanding more about what's going on than what other solutions require.
(Tongue-in-cheek, but I'd actually like to see this happen: Nix is a fantastic concept obscured by space-alien syntax.)
I don't understand the concept/motivation behind it, everything that nix does should be able to be done in userland, like podman does, which I love.
The daemon is not powerful at all, almost all the logic happens in the client.
The client does the parsing, job ordering, and tells the daemon exactly what to do.
The daemon, only required in multiuser environments, does only two things really.
- ensure that the /nix/store is protected as the daemon should be the only process able to _write_ to it. Everything can read from the nix store; no nix required at all.
- execute build commands in a sandbox. Providing isolation between multiple builds.
I'm not sure if there are other reasons.
The biggest drawback is installing Nix on OS X is a huge pain. Docker has lots of magical UX tooling to make it rather seamless in comparison.
Did it on an aarch64 mac the other day. One command (two?), 15 minutes, done.
I spent time understanding it, and getting it working, but it really doesn't work just universally. Once the install process becomes more like, say, miniconda -- where an unprivileged user can install it locally with ease -- nix will get a massive boost in my books. Until then, I can only yearn.
But, I would encourage people to try out NixOS. Its much better than the package manager, yet it follows the same basic principles.
- Uses a simple DSL language
- 1 config file describes your entire environment, you basically use nix the language to tell your computer if you want wifi enabled or not, or if you want sound, or if you want i3 etc.
- Its easy to roll back, since the config file is versioned (like git)
I personally use a mac machine, running nixos in vmware fusion and I can't believe how long I had been using a separate machine for development and another for personal use.
I get the best of both worlds with this setup; my messages and notes are here, I get world class hardware (come at me bro), and I get to control every single aspect of my development machine.
I still use docker inside nixos, and yes I know its almost supposed to replace docker and all but I will get there one day, right now is not it.
Areas for improvement: - They should have come up with a better name: nix, Nix and NixOS are confusing (language, package manager and operating system - in that order. Yes, they went with an upper case letter for the pkg manager) - Docs NEED to be better, this is not an easy task. The language is shared between every component. - Give playgrounds to beginners, I shouldn't have to download the minimal iso and boot it on my machine to get a sense of how powerful it is. There has to be an easier way.
End of my rant. I started using it a month ago, I have run into issues with dependency pinning but I remain optimistic.
It's astounding because the local version is doing a naive, case-sensitive regex search, which is pretty bad when you're looking for, say, the Perl package MIME::Lite which can have various junctions and capitalizations. In fact, that package has a listed name of perl5.34.0-MIME-Lite but is installable as nixpkgs.perl534Packages.MIMELite!? I can't even
I found the code a few months back (but can't be bothered to look it up just for a comment). I didn't fix it then because I had other priorities than learning how to modify my local copy of nix to test it.
For $REASONS I want python 3.7.10, and the full scientific stack (numpy, scipy, pandas, numba, matplotlib, ...) at the latest compatible versions along with pytorch. I don't mind waiting for things to compile. How, if at all, can Nix help me get into an environment that meets those constraints? Can it help without requiring me to find and copy hashes of things?
Put an incorrect hash in. Run the build. The error will tell you what hash it actually got. Copy that. Run build again.
Both for parent's quandary, and for when you're working with a group and don't want to force everyone else to use Nix.
This makes me wonder: does Nix use libsolv, or a similar idea?
Roughly, Nix's approach is to describe packages as a function of it dependencies as inputs. (And all the inputs have all their dependencies described in Nix, too). Nix doesn't do things like "install latest version of X". (One of Nix's principles is build reproducibility; the package should have the same behaviour if built with the same input).
Tools like mach-nix or poetry2nix wrap around nix.. as I understand, they adapt the requirements.txt or whatever and pass it into Nix in a way that Nix can understand.
As for Windows support: It seems to be possible to use nix in WSL [0] but I've never tried that. I have used nix alongside apt and pacman on Ubuntu/Arch before I decided to go all the way and install the NixOS distribution. Using it alongside other package managers worked really well.
I've used Nix on Linux (i686, x86_64 and ARM), macOS and Windows (WSL2). I believe it also works (although not officially supported) on BSDs, etc. too, although I've not tried that yet.
> Lorri sounds amazing though! ...which handles the "this directory needs these specific packages" installed locally, not globally problem that Debian gives you).
You're describing Nix, not Lorri. Specifically:
- nix-shell provides a directory-local environments (and more, e.g. #!nix-shell to fetch script dependencies automatically)
- direnv can enter/exit this nix-shell environment when cd-ing in/out of a directory
- lorri makes direnv+nix-shell faster, by building the environment asynchronously in the background (rather than causing our terminal to freeze)
like "nixpkgs" is almost always the default, from what I can tell, so it could be omitted and simply be assumed to be the default, and not sure what the -c param does but perhaps it could also assume that the specified package(s) are also the ones to install/choose, in which case the whole thing could be like `nix shell -c python3`?
Could it solve the issues we're seeing lately with NPM?
There's a reason why, despite being almost 20 years old, Nix has at best a small cult following. It just doesn't solve the problems that most people are looking to solve, most other solutions are simply easier and in many ways better
Are there any other advantages to using nix?
The advantages are more pronounced for DevOps than for developers.
e.g. for DevOps, Nix allows copying a package of software (and all its dependencies) from one computer to another, with confidence that the programs will work on both machines.
For developers, Nix is more appealing if you ever work on more than one computer. e.g. with Nix, it's easy to ensure you've got the same version of packages installed regardless of whether you're on macOS or Linux.
It's pretty neat for side projects, in order to get "I was able to build it now, I'll be able to build it in 6 months". Whereas, if you're otherwise relying on Ubuntu's system packages, maybe the package versions got updated, and so you'll need to spend time to get your program to work with the latest compiler/libraries.
> Hermit is probably most similar to asdf, but their goals differ. Hermit's goal is to make isolated cross-platform tooling consistent, self-bootstrapping, and reproducible at the project level. asdf's primary goal is to allow developers to install and switch between multiple versions of languages and tooling.
The downside for the author of this post, though, is that Hermit doesn't yet support Ruby because it's not static/relocatable.
[1]: https://cashapp.github.io/hermit/ [2]: https://cashapp.github.io/hermit/faq/#asdf
Be careful if you’re also interested in Hermit. These kinds of things bit you up way down the road when you least expect them to.
I'm quite happy with direnv to avoid this problem.
Funny enough, it was submitted to HN most recently just yesterday:
https://news.ycombinator.com/item?id=30908321
direnv is complementary to the various language-version tools, so it obviates needing asdf:
https://github.com/direnv/direnv/wiki#project-layouts
But it seems some folks combine the two:
https://blog.mikecordell.com/2021/12/18/better-project-envir...
You are giving people a _ton_ of trust when cloning a repo or pull request that has a .envrc which will be automatically executed by direnv. This file could do anything from steal your SSH keys to delete your entire home directory or worse. And the only thing preventing that from happening is the suggestion of "oh be sure to eyeball the .envrc file and make sure it looks ok, then run this command to enable it". People will just google for the first "how to I unblock .envrc file" and blindly run the command, then oops. Or a determined attacker will just obfuscate what they're doing so the .envrc looks fine but you failed to realize some esoteric bash-isms were actually invoking an obfuscated script and... oops. It's just begging for a supply chain disaster on a similar scale as npm's infamous issues.
VS code and some vim extensions have similar issues with automatic project-specific configurations that allow arbitrary code execution too, and neither have a good solution beyond 'just read all the code and understand it to make sure it's not going to hurt you'. It's not really a unique thing to direnv.
We really need a better model for collaboration and consistent dev environments. I think containers and docker/chroot/etc. environments with explicit opt in of your local resources, configs, files, etc. are a much more sane and security conscious path towards it. A script executing to setup my python environment for a project should never, ever have access or even know about my personal password store database for example (unless I explicitly decide it should).
> And the only thing preventing that from happening is the suggestion of "oh be sure to eyeball the .envrc file and make sure it looks ok, then run this command to enable it". People will just google for the first "how to I unblock .envrc file" and blindly run the command, then oops. Or a determined attacker will just obfuscate what they're doing so the .envrc looks fine but you failed to realize some esoteric bash-isms were actually invoking an obfuscated script and... oops.
You need to be absolutely sure you've read and understand every single line in the .envrc file, and every single line in any script it may be invoking, before you run direnv allow. Otherwise you are giving code from the internet a blank check to do anything on your machine with your user account.
I personally do not think bash/shell is a sensible language to trust that you can quickly or easily determine from a visual check alone if a script might be doing nefarious things.
Seems safe to me
If I wanted to include it, I use something like git-crypt and encrypt the contents
Personally that's not something I can live with as these binaries are sometimes launched many times in subprocesses.
To be clear since I think it might not be obvious: lapser is talking about asdf-direnv, not direnv by itself. See https://github.com/asdf-community/asdf-direnv
They just released a major new version (asdf-direnv), so might be worth giving that a shot and see if it works for you with asdf?
IIRC the main reason our team started tracking go versions was we were already using `asdf` for tracking other tools and it’s a nice way to ensure that everyone/everything was using the same to version (e.g. for unit tests which usually aren’t run in a container) but it is another spot to keep in sync with the Dockerfile.
- https://github.com/asdf-vm/asdf/issues/383 - https://github.com/asdf-vm/asdf/issues/547
They did do something to ameliate this though: now they refer to the proect as asdf-vm as much as possible, to distinguish it from Common Lisp asdf.
I've even tried doing that with all the devtools we have. Like normally a developer here has to install gcloud, terraform, kubectl, apt-get lots of stuff, and then 3-4 internal tools. Then configure all of it, and of course some stuff will just not work on someone's computer. But creating a docker image including all that means that I can grab a new computer and be up and running in minutes.
I did some googling, but I’m unfortunately not experienced enough to be able to describe the problem succinctly to google.
Using pylance, btw.
TIA!
This works in VSCode over SSH perfectly fine - the locally running VSCode is able to detect and select Python environments in the remote server.
"Setting up a Python environment" takes about 10 minutes and it's dead nuts reliable.
It is a very effective package manager.
Conversely, the experience of using Ruby within Docker for development is often clunky and awkward by comparison.
I don’t see why this is so hard to avoid with per-project version pinning. I’ve never had this problem with Java.
This seems like a lot of effort and complexity to work around global package installation. Just stop assuming that packages are global and this would all go away. How do we know that? Because other languages don’t require this kind of workaround!
I was amazed to find such a mess. Each project has full copies of all sources of all modules you use? They’re not shared in a global cache? There’s just hundreds of thousands of individual files?
Yarn does a better job on some of this, but it all feels like stepping into an alternate reality where no one has ever heard of Maven.
Maven predates Node by 5 years. Even if Node was developed without knowledge of Maven surely someone has brought this up in the last 13 years, right?
It’s all very surprising to me, and I guess an interesting lesson in “parallel” evolution.
I'd respond to production disasters with hacky bash scripts and then we'd spend the next sprint incorporating that functionality into the server so the hacks weren't necessary. We kept catching ourselves working really hard to optimize what we thought at first needed to be custom code but what ended up being easily achievable by leaning on well-known non-java tools like `diff`. There's something about the way Javs encapsulates everything into a JAR that discourages Java devs from using anything on the outside.
If you can live in a world where everything you need is in the JAR, life is good, but that hasn't frequently been my world.
I'll agree that how to do things properly with Ruby isn't obvious when you're new to the language - just as it isn't obvious how to do things in Java (or other JVM languages) when you're coming from Ruby or another language.[0]
But Bundler doesn't work all that differently from Maven, in the end. Instead of running your commands through `./mwnw`, you run them through `bundle exec`[1]. Dependency management is straightforward and mostly hassle-free (the problems arise "only" when you use C extensions which, to be fair, is not that rare, but I don't really see a way around this in a language where you need C for certain fast things). In particular, Bundler by default[2] also stores dependencies centrally like maven to avoid duplication and then selects the appropriate version of a given dependency (unlike e.g. NPM which stores everything locally).
Rbenv (or alternative tools such as chruby or asdf) solves a problem completely distinct from Bundler or Maven, it's about selecting the right Ruby version for your project, a problem that also needs to be solved with Java. IME, many developers just let the IDE deal with that, but Ruby developers are more used to running things from CLI, so that's why rbenv exists. In any case, the most popular analogue for Java would be sdkman which works, mostly, the same way (and which, IME, is even a bit hackier than rbenv).
JS and Python are different. Node is a mess IMHO, and Python isn't able to agree on which package manager to use (I would hope people would migrate to Poetry, which seems to be doing things right).
[0]: For example, one thing that I find very annoying over in Java-land is that it's a real hassle to make sure things behave the same way when called from the CLI as opposed to from the IDE, such as setting the active spring profile. This is because, mostly, the IDE circumvents maven/gradle (you can run things through the build system, but typically the output, e.g. test output, is better when using the IDE-internal system, at least with IntelliJ).
[1]: There are "hackeries" to get rid of having to run everything through "bundle exec", such as binstubs and direnv, although I would mostly call them "shell script tricks", and anyway, if you instead just alias "bundle exec" to something shorter or create a wrapper script, it's not really worse than `./mwnw`.
[2]: This can be overriden and is actually a good idea for production builds, especially if you use a multi-stage docker build since then it's easy to copy over all your dependencies.
Not to say that I like the Python package management story.
It’s also possible to install multiple versions of Python on a system. The dependency management is the real problem — having more than one version of a runtime is not the hard part.
> The dependency management is the real problem
I'm not sure how this works in Java, but in many ecosystems like JavaScript and Rust dependency management isn't an issue at all. Installing a package defaults to a local install and even things like dependencies transitively depending on different versions of the same package are supported out the box and just work.
Previously: https://news.ycombinator.com/item?id=26018684 (Feb 2021: 98 comments)
FYI, the link to asdf there is a link to google.com
1. You need a tool for X to solve an issue so you write it. (AIM)
2. Guy over there needs a tool for Y to solve the same issue, so he writes it. (Yahoo Chat)
3. So many tools exist, we need to merge them all into one. (Trillian, Adium)
4. Merging all the tools created a monster, we need a common protocol they all understand.
5. No one remembers how tool X works anymore, updates become more sparse.
6. Both X and Y are no longer popular, big company took over. (Slack)
When I set `ruby: 2.6.8` in my `dev.yml` file, for example, I get this Shadowenv program written out to `.shadowenv.d/550_dev_ruby.lisp`:
(provide "ruby" "2.6.8")
(when-let ((ruby-root (env/get "RUBY_ROOT")))
(env/remove-from-pathlist "PATH" (path-concat ruby-root "bin"))
(when-let ((gem-root (env/get "GEM_ROOT")))
(env/remove-from-pathlist "PATH" (path-concat gem-root "bin")))
(when-let ((gem-home (env/get "GEM_HOME")))
(env/remove-from-pathlist "PATH" (path-concat gem-home "bin"))))
(env/set "BUNDLE_PATH" ())
(env/set "GEM_PATH" ())
(env/set "GEM_HOME" ())
(env/set "RUBYOPT" ())
(env/set "RUBYLIB" ())
(env/set "RUBY_ROOT" "/opt/rubies/2.6.8")
(env/prepend-to-pathlist "PATH" "/opt/rubies/2.6.8/bin")
(env/set "RUBY_ENGINE" "ruby")
(env/set "RUBY_VERSION" "2.6.8")
(env/set "GEM_ROOT" "/opt/rubies/2.6.8/lib/ruby/gems/2.6.0")
(when-let ((gem-root (env/get "GEM_ROOT")))
(env/prepend-to-pathlist "GEM_PATH" gem-root)
(env/prepend-to-pathlist "PATH" (path-concat gem-root "bin")))
(let ((gem-home
(path-concat (env/get "HOME") ".gem" (env/get "RUBY_ENGINE") (env/get "RUBY_VERSION"))))
(do
(env/set "GEM_HOME" gem-home)
(env/prepend-to-pathlist "GEM_PATH" gem-home)
(env/prepend-to-pathlist "PATH" (path-concat gem-home "bin"))))
I really like this strategy. It's really nicely generalizable to any of these language runtimes that need to change on a per-project basis."Late but latest" -- Rajinikanth
https://github.com/asdf-vm/asdf/blob/master/lib/commands/com...
Thalaiva! :)
[1] https://docs.gradle.org/current/userguide/toolchains.html#se...
[2] https://github.com/halcyon/asdf-java/graphs/contributors
The only plugins under the asdf-vm github org are for Ruby, Node.js, Elixir and Erlang, because those are the only languages I needed.
Not sure the error lies at the feet of asdf, though.
For ruby/node it's a relief to be able to easily "activate" a certain version of ruby and a certain version of nodejs - at the same time, via simply "asdf local ruby ... and asdf local node ...".
Not sure I'd do this, though:
mkdir -p ~/.config/fish/completions
cp ~/.asdf/completions/asdf.fish ~/.config/fish/completions
But more probably add a symlink to the completions managed by git/asdf:
ln -s ~/.asdf/completions/asdf.fish ~/.config/fish/completions/Docker is better for version managing services like databases, caches (Postgres, Redis, etc), things that have little need for different configuration or exploration and persist through multiple sessions. Once they're up, they're done.
Asdf is the next best thing for local development, where you need that kind of exploration.
There are advantages to the docker approach, and Nix can be painful to get going, but a significant portion of the community (including me) find the pain to be worth it.
For the most part, latest version linting is good enough for me, currently.
It was really impressive how smooth and quick the process was. Great tool!
No crazy settings in your profile. Downsides are: You need to have root, you can switch any time but different versions don't work at the same time, and it does not work in windows.
This isn't true
> different versions don't work at the same time
Within one stow directory: true. But nothing prevents creating multiple directories (I don't think I've ever done that).
It strikes me that not for the two above items we might be able to solve this with $PATH resolution and directories filled with symlinks to our "development versions."
Just today on trying to get rvm to do something I got angry at the number of language-specific package managers I have installed: nvm, jenv, rvm, rbenv(after I couldn't get rvm...)
Of course, I know about Nix but it is too complex for my use cases.
No, asdf is a replacement for them. It's not an abstraction on top of them. It uses its own plugin system, and everything is written purely in bash. Everything gets installed in `~/.asdf/installs`
> asdf version resolution is slow which makes every command execution pay that penalty. asdf reshim is needed for finding new executables, and some tools are not happy with their executables being masked by shims.
> Perform asdf version resolution only once and defer environment loading to direnv.
Package managers often don't have a way to install specific old versions of a package, or multiple versions of a single package. That's the whole point.
Regarding the suggestion to “do things manually” — what is the value of doing things manually? For me, it is very far away from how I want to spend my energy, which is doing computer things that only I can do. I am happy to outsource environment variable fiddle faddling to someone else.
It can't actually install different versions though (looks like `asdf` can?), which is somewhat inconvenient.
if asdf could have a plugin that hooks into their shims to also handle direnv I would be in heaven
edit: just did a quick google search and it exists, i'm elated
I found it works well for Ruby, Elixir/Erlang, and Node.
let's see if the change is as smooth as it says!
pyenv I can understand. dunno the others.
but goenv?? you deserve whatever hell this is. it's a single binary configurable with an envvar for gopher sake. just RTFM.