Of course, it is better than languages with lots of brackets, but still not good enough.
[1] https://github.com/edolstra/nixpkgs/blob/release-19.03/flake...
Of course, it is better than languages with lots of brackets, but still not good enough.
[1] https://github.com/edolstra/nixpkgs/blob/release-19.03/flake...
{ pkgs ? import <nixpkgs> {}}:
with pkgs;
python3Packages.buildPythonApplication rec {
name = "quicktill";
src = ./.;
doCheck = false;
propagatedBuildInputs = with python3Packages; [
dateutil pyyaml
sqlalchemy psycopg2
pycups reportlab
requests_oauthlib
pygobject3
];
nativeBuildInputs = [ wrapGAppsHook ];
buildInputs = [ gobjectIntrospection gtk3 ];
}
The only big things here are the fact that this is defined as a function that takes the package repository as an argument to access dependencies (the first line), and the "with" expressions that allow me to skip having to type "pkgs." and "pkgs.python3Packages." for every package I depend on. rec {
name = "quicktill";
src = ./.;
doCheck = false;
propagatedBuildInputs = with python3Packages; [
dateutil pyyaml
sqlalchemy psycopg2
pycups reportlab
requests_oauthlib
pygobject3
];
nativeBuildInputs = [ wrapGAppsHook ];
buildInputs = [ gobjectIntrospection gtk3 ];
}
Is that any better? It looks an awful lot like some dialect of something JSON-like to me - there's some different symbols used and array values are separated with spaces rather than commas, but aside from that it's just a record of key-value pairs.From there, the first line in the original example says "the following expression is a function that is called with this parameter", and the parameter is an object containing a key called "pkgs", which is defaulted to the result of "import <nixpkgs> {}". This is explained in more detail in a handful of lines in the language manual.
Functions are called just by referencing the function and then the arguments separated with spaces, like Ruby or Haskell - so python3Packages.buildPythonApplication is a function that is called with the object above.
Finally, "with foo;" just means "every key in foo can be accessed without typing foo. in the next expression".
The result is basically: this file defines a function which takes an object containing the package repository as the "pkgs" key, and returns the result of calling pkgs.python3Packages.buildPythonApplication with the object defined in the rest of the file.
It's a lot more derived from the syntax of functional languages than C-like ones, but that's not necessarily a bad thing. Also: this is basically the entire language. There's a couple of different string syntaxes and some stuff for merging objects together, and also a mechanism for temporarily naming things that aren't part of an object, but in general... there's not a lot more to it. Most of the complexity is in the domain itself - what's the difference between a propagated, native and regular build input, how do you manage plugins and options for a package, etc.
What's your preferred packaging DSL?
But your example looks nothing like Json.
Nix is great in concept but the language or idioms make it really difficult to use.
Regarding syntax, I would prefer something like this:
DEPENDS_ON python 3.5.1, python/dateutil 1.2.3, ...
BUILD_TOOL bash 1.2.3
BUILD_SCRIPT ./build.sh
In practice, the default set is expected to be somewhat internally consistent, so that you can just use the package names to refer to the "most recent consistent set". But if need arises, you can also override individual packages to pin them at a different version than the upstream-provided one.
Well you might be right, but I find Nix and NixOS to be great. Honestly the language isn’t the issue, it’s just that it isn’t nearly as well supported as more popular distros like Ubuntu, so for example my VMWare Workstation license has been sitting dormant for a while now... (Which is mostly OK. I’ve been using libvirt for everything and pleasantly surprised at what it can do.)
The language takes some getting used to, and I am not really 100% sold on pure functional, but it works and my systems are much more reliable now.
First of all, "attractive" is simply your way to say "familiar to me".
Then, a language need to be just powerful enough to express it's semantic and no more.
This critique is quite hollow and noisy.
Nixpkgs itself does a lot of funky things, especially around overrides and whatnot, but those are features of Nixpkgs, not of Nix the language.
Haha yes, I mean clearly this means it's Nix's fault. Has anyone ever considered using you as some kind of "overengineering divining rod" where they can just wave something in front of your nose and go back to the drawing board if it doesn't pass?
(Yes, I know, JSON is not a language, but people do sometimes use it for things approximately as long and as complicated as a Nix expression.)
But why isn't there an ML with the good parts of YAML, but without the bad parts?
AFAIK, one can not subset YAML and get something coherent. But one can start from scratch and use its concepts. I imagine the languages are not there just because nobody got the time to do them.