If the ideas seem pointless and confusing to you, that's fine, don't use it. There are bunch of great package managers and linux distros that will probably suit you better. But, if you see the need for declarative package management, then Nix is for you.
I'm a phd student in computational science. I use a bunch of different packages on my computer and I need to know exactly what I've installed and I do not have time to debug problems from dependency hell. Nix and NixOS have been two of the most interesting and useful tools I have every used. Not only have a gained huge productivity boost from having reproducible environments and declarative package management, but I've thoroughly enjoyed the process of learning these unique tools that, for me, are leagues better than any package management system I've used in the past.
If it didn't work for you, I hope you find a tool that suits you better. But that doesn't mean its bad. It might just mean it wasn't intended for you.
That's a terrible copout. Nix ought to be a great deal more accessible than it is. The premise ideas are sound, but the UI/UX is not.
In my case, I have a few different computers, and I declare all of their environments with NixOS in the same directory. Then I use syncthing so that all the builds are automatically updated and in sync. This means that I can develop something on my desktop, and open up my laptop and run it without configuring anything. If it works on my desktop, it works on my laptop and vise-versa.
Of course this is a whole env thing and not just a package thing but I dunno I'd almost rather build a container and work within that than write nix to get this functionality, the ergonomics of teh language are that galling for me.
Started using nix this year, language is easy to use. Has very few concepts and syntax, it’s a standard functional language with all those goodies and a clean syntax in my opinion.
The language is fine, especially compared with its alternatives (e.g. templated yaml, yuck).
It's fairly straightforward to use. Running `devenv init` and then looking at the devenv.nix file should be all you need to know what to do.
Package names can be found by `devenv search $name`.
If you're happy writing shell commands/scripts, then just stick them in the following template:
with import <nixpkgs> {};
runCommand "name-of-your-thing"
{
someEnvVar = "some value";
someOtherEnvVar = "some other value";
buildInputs = [ programs you want to run ]; # e.g. see search.nixos.org/packages
}
''
run any bash code you like here
just make sure the file/folder you want to output
uses the env var "$out" as its path
''The Nix language is designed by people that think everyone is familiar with lambda calculus and function programming. That's fine. But it's crazy to use a language like that for something that everyone has to use.
I bet Nix would be way more popular if it used something like Starlark instead.
I wholeheartedly disagree. Nix's `a -> b` is just a boolean function, like `&&`, `||`, `==`, etc. It's meant for assertions, e.g.
assert format == "csv" -> depth data == 2;
Most languages allow assertions like this; they'd just be more awkward, like assert(depth(data) == 2 if format == "csv" else True)
In fact, a common complaint about the Nix language is that it's untyped: which shows just how informal it is!> The Nix language is designed by people that think everyone is familiar with lambda calculus and function programming. That's fine. But it's crazy to use a language like that for something that everyone has to use.
The Nix language is basically just "JSON with functions" (although the syntax is unfortunately different, since JSON wasn't so popular back around 2003; it does support XML though!). There's only an emphasis placed on functions since they're the USP of the language; otherwise we could just use plain JSON. Lambda calculus is just a simple model of functions; you don't need to know or care about it in order to write functions in the Nix language. In the same way that you can write integer arithmetic in Nix without knowing Peano's axioms, or von Neumann's set encoding of ordinals, or whatever.
I've not used Starlark, but it seems to be waaaay more complicated than "JSON with functions"; e.g. it has loops, which makes the semantics dependent on some notion of time/temporal-ordering, which is sounds like a massive headache.
I'll keep trying to give Nix and the language more work on my end.
Trying to use a container to accomplish the same thing is not a substitute. They are fundamentally different.
How are you meant to install a piece of software and keep it up to date?
Is it a channel or flake? Are flakes stable or only for testing? So what's homemanager for?
Good luck getting answers on those questions other than "read the source code" and then followed by "no, not that source code, this branch here".
I really like the idea of Nix, but the communities priorities leave a lot to be desired of.
I usually recommend this guide for newcomers to Nix: https://zero-to-nix.com/
I don’t think there’s a beginner-friendly guide to NixOS. I personally learned it (and continue to!) through a number of blog posts and examples on Github. The NixOS manual is a key reference to rely on, but not really a tutorial: https://nixos.org/manual/nixos/stable/
Some of these 200+ issues are unsolved for a fairly long time.
It's a very ambitious project, so a lot of issues are related to either Nix or general support for each language/service.
Though something that annoyed me with the recent v1 release is that it changed the default repository where it pulls the package definitions from Nix's official to a fork made by the author.
That is dangerous and also lags behind an incredibly active and large upstream.
If you want to patch things, use proper Nix overrides or apply the patches using devenv code, don't fork a +80,000-big rolling release package repository.
I can unzip a directory, cd into it and cargo build it and for the most part it just works.
The fact that we have added shared libraries and environmental variables and so many other magic incantations that we need massively complicated second systems is an indictment of our culture of complexity.
I believe Go also embraces that level of simplicity.
And when it comes to deployment, instead of needing a simulation of a whole operating system (containers), I can just remote copy a directory and just have it work.
For example, anything using bindgen needs libclang, and to make matters worse, doesn't look in the conventional LIBRARY_PATH but requires a special environment variable LIBCLANG_PATH.
I often want to have some packages/tools installed when I'm working on a project and docker isn't always the right fit, which is where devenv comes it.
I basically use it as a generalized version of venv.
* Declarative -- as a developer, I don't care... Why is this important? Also, declarative means there's a bunch of imperative code hiding behind it. It just makes it harder to debug when things break.
* Composable -- in over 25 years of being a developer not even once did I want my dev. environment to compose with another...
And the article opens up with:
> Simple JSON-like language
Why on earth?.. And things down the road that announce "features" like "run processes"... Is this some kind of April 1st joke that is meant to be funny because its two weeks too late?
How fast it installs, how fast it's ready when needed. This can be relevant depending on how you use them. For example, if I let every script run in a separate environment, it would matter if it's ready in 10 seconds or 10 milliseconds.
> Declarative -- as a developer, I don't care... Why is this important? Also, declarative means there's a bunch of imperative code hiding behind it. It just makes it harder to debug when things break.
As a developer, I do care how much work something will offload on me. And declarative is more about the state of the world, than the execution of a process. If there is a trustable system which can manage that world for me, then I will have less work, and fewer problems.