1. [Comment removed by author]

    1. 2

      Are error messages from parser combinator libraries as bad as the ones from yacc?

      Yes. They tend to just give an error for the combinator itself, and provide no larger context.

      1. 2

        Did you perhaps mean to comment on this post instead?

        1. 1

          Yes

      1. 3

        There is already https://github.com/defunkt/gist btw

        1. 4

          I’m kind of disappointed declarative user profiles didn’t make it into the release. That was the big thing I was looking forward to.

          1. 2

            That would solve a lot of problems and replace ad-hoc tools. I’m glad to see that this is on the roadmap for Nix!

            1. 2

              A lot of people, including me, are already using home-manager successfully. It has its own set of user modules (out of necessity) and works like NixOS’ configuration.nix. It also has a NixOS module you can use to put all your home-manager configuration directly into configuration.nix and have it apply in a single nixos-rebuild switch. Its state is moderately active, getting a decent amount of PR’s which are merged quickly. I and many others can definitely recommend it to anybody using NixOS.

              In comparison, the PR you linked seems more dead than anything. The creators of home-manager (rycee) and NixUP actually intended to work together at some point, but from what I heard from rycee, there wasn’t much communication for a while now.

              1. 1

                How is it dead? It’s just been awaiting review for a while.

                Home manager does seem like a good option, and I’m sure it works, but I’d like to see something that’s built directly into NixOS.

                1. 2

                  No update in 6 months and very sparse updates in general, there have been a ton of merge conflicts for a while now. The author almost hasn’t been active at all the last 12 months. There have been multiple instances of him picking it up again, but then silence again (see the comments on the PR). It’s now the third oldest open PR in nixpkgs. It’s probably one of the biggest changes to nixpkgs too.

                  The main reason for the success of home-manager is probably just that the author set up a nice repository with a readme and spreading the word. And it’s completely usable on any Linux and even macOS, all in user space, the NixOS integration module is the cherry on the top.

                  1. 1

                    I see, that’s a little disappointing. I’ve been following the PR for a long time - while it will get put to good use either way, I even made an additional donation to Nix purely because I was hoping to see some work going towards it. I was hoping to see it merged soon. I guess I’ll have to start taking a better look at home-manager.

                    Do you know if there is any reason home-manager hasn’t been merged into NixOS? Is it not suitable to be in NixOS, or is the plan to get it in at some point?

                    1. 2
                      • Always having to do PR’s to the already PR-overloaded NixOS will probably reduce home-manager’s development speed.
                      • home-manager modules can’t be shared with NixOS modules as of now, which means there would be lots of duplicated functionality in a single repo, which nixpkgs maintainers wouldn’t like.

                      These are the reasons I can think of right now.

            1. 2

              This might be the best git tutorial I have ever seen, well done! While most of these concepts were known to me, this holding hands through the commands really got me more comfortable with them.

              I noticed a mistake in a command though, there’s a > too much in echo cloned change rebase >> anewfile.

              1. 1

                Well I tried this out, and just after a couple minutes with 5 people or so playing it stopped working, reconnecting doesn’t help. Cool concept but it seems a bit buggy!

                1. 16

                  I’m not a devops guy, but I use Nix for this sort of thing in my personal projects.

                  A less invasive approach might be Dhall, which I’ve not used but AFAIK you can write your config with functions, etc. and run a command to “compile” it into e.g. a JSON file.

                  1. 7

                    I can vote for Nix as well, it can do exactly what OP needs. Nix is a lazy, functional language pretty much made for writing configuration. Specifically Nix can solve their problem because:

                    • It can build output paths, which can for example contain a from Nix generated config, along with the parameters used.
                    • Fetch Nix expressions from a repository and evaluate them, this let’s you parameterize your repos.
                    • Nix has lists and attrsets (records), which represent structured data.
                    • Makes it very easy to deal with environment variables

                    Edit: As an interesting example, check out my ssh keys NixOS configuration which sets up an nginx virtual host for all my public keys (declared in another Nix file) including an automatically renewing Let’s Encrypt certificate. The function to convert an attrset to a folder structure I wrote is here (should probably make a PR to add it to nixpkgs).

                    Nix has so much more to it though, there’s NixOS built on Nix with an insanely powerful module system, there’s NixOps for deploying NixOS machines. And most importantly nixpkgs and the Nix package manager which builds packages in a reproducible fashion and enables a lot of stuff you wouldn’t even have thought of. For the interested I can recommend dropping in #nixos on Freenode.

                    1. 4

                      thumbs up, dhall looks esoteric, but actually seems like an amazing solution for making statically typed config generators.

                      1. 2

                        Both nix and deals look neat, but for ops the last thing we want is more esoteric things. Life is hard enough using normal tools!

                        1. 3

                          I don’t think you understand the point of it, sometimes you need to step outside of the normal things to make life simple again.

                          1. 3

                            I’d recommend considering that the reason life is so hard with normal tools is because they’re all trying to solve the same problem in the same fundamental way. Trying new tools that work the same way is going to ultimately end up in the same painful position all the other ones have lead us to. This is why I recommend trying Nix.

                            1. 1

                              I totally agree…

                              I recently shifted my desktop to nix, it is fundamentally different, and solves all these problems better. I was experimenting with broken configs, and could revert the whole OS atomically via grub. That is power I haven’t seen anywhere else, and yet I didn’t even need to know how it works, it was just an option presented to me when I booted.

                              My next set of servers is going to be nixops, or something directly inspired by it.

                            2. 1

                              I think it’s relative: I think if you’re using Chef/Puppet/Ansible/Docker/etc. then Nix is just another alternative, which IMHO is cleaner. It’s got a decent community, commercial users, etc. so if you’re thinking about adopting one of these technologies, Nix is definitely worth a shot and I wouldn’t consider it esoteric at all.

                              The problem with Nix for a situation like this is that it’s quite heavyweight; just like switching a server over to Puppet or something is also a heavyweight solution to the problem of “put different values in these config files”. I would say Dhall is certainly esoteric, but I think it’s worth a look for solving this problem since it’s so lightweight: it’s just a standalone command which will spit out JSON. In that sense, I think it’s a more reliable alternative to hand-rolled scripts, which wouldn’t require any extensive changes to implement (call it from bash, like anything else; use the JSON, like anything else).

                        1. 1

                          That table mode seems excessively verbose. My own home-brewed example uses tab-delimited fields and a few special markers:

                          #This is a caption line
                          *header1 header2 header3
                          data1 data2 data3
                          

                          (only in this example, replace spaces with tabs). It’s easier to create (but admittedly a bit harder to read in the raw format) and easier to parse (since the output in my case will always be HTML).

                          1. 3

                            The thing is, org-mode does all that verbose stuff for you, have a look at this great demo that shows what you can do with tables: https://youtu.be/fTJVLJd_gz0?t=2m45s

                          1. 2

                            While I agree that you can learn a lot of technologies one works with, there is a thing you probably won’t learn like this: New ideas. Which is completely understandable, production environments can’t afford that. Only the very few technologies that survived for a decade or so do eventually get adopted for work (bar some exceptions). I’m talking about things like Idris, Elixir, Nix, Rust, and more, all of which have some great thinking behind them.

                            1. 3

                              Rust was developed at an organization that wants to use it (Mozilla) and has been adopted by companies that want to use it (e.g. Dropbox). I know companies that have used Nix. Elixir is also used by real companies.

                              1. 5

                                I’ll “me too” on this one. Where I currently work we have quite a bit on Rust in production. There’s a little bit on the cloud side and a significant amount on our hardware product (embedded linux box).

                                The last place where I worked had Elixir in production too. Just a little bit in a mostly erlang codebase.

                                1. 0

                                  While Rust has seen some adoption recently, on a global scale it’s pretty insignificant

                              2. 3

                                Why couldn’t you learn those things at work?