Hacker News new | ask | show | jobs
by lilyball 2055 days ago
On the contrary, I find it super helpful to set up my workstation. I don’t use any other package manager on macOS these days, everything is Nix, fully declarative with a small script that basically does `nix-env --install` (but with the flags to replace my current environment wholly, and with some helpers around showing what changed). I can then just sync my config between my machines and run my script and get identical setups on every machine I use, and I can update all of my packages at once just by running `nix channel --update` followed by invoking my script again.

And there’s a bunch of utilities I use rarely so I don’t even keep them installed, since I know I can just `nix run nixpkgs.hello -c hello` if I ever want to run them.

And then for a work project I set up a custom derivation that I can use when I need to run the occasional scripts that require the custom ruby and python environment, so I can just run e.g. `nix run nixpkgs.my.env -c pod install`. This way I’m not even polluting my global environment with this stuff the way the work scripts expect. And I’m currently working on formalizing this into Nix derivations in the work repo directly (in an attempt to convince my coworkers that we should all use Nix).

1 comments

"nix is useful for getting the same version of programs on different computers". This is obviously useful to have.

Say for the use-case of "I have a macOS laptop, and I use Arch Linux on a different computer". I can't genuinely recommend nixpkgs as better than just running "brew install..." and "pacman -S" (and whatever AUR tool is in vogue). -- Yes, once you know what you're doing and have a configuration, nixpkgs is nicer. But it's not as if the good-enough alternatives are too hard.

When there are more hurdles to getting the bleeding edge (like on Amazon Linux or whatever), I appreciate how much easier it is to just "install nix, install my packages". But even then, installing a recent version of tmux or fish or whatever is a quick search and a few commands away. (Which isn't that much if you only have to do it once every few months; and/or note how to do it in some script or markdown notes).

I don't understand the "I have a macOS laptop, and I use Arch Linux on a different computer" claim. If anything that's an even better time to use Nix, because it means I only need to know one package manager instead of two. The setup I currently use on macOS could be dropped onto a Linux machine and I expect it would work with zero changes there, or I could switch over to home-manager (probably a good idea, I just haven't done it for historical reasons). And if I don't have a setup yet I could just use `nix-env -iA nixpkgs.pkgname` to install stuff the way people usually get started with Nix.