News for hackers. Stuff that matters.
Re:How Nix and NixOS get so close to perfect by danmur on Sunday April 24, 2022 @07:07AM (#31142931)
I love many aspects of Nix but for me at least the language is a barrier. I spend time and get better at it but there's a fine number of things people can spend that time on.
Re:How Nix and NixOS get so close to perfect by 0des on Sunday April 24, 2022 @07:41AM (#31143113)
JSON would be a nice way to make a config file. I say this as an xmonad user too, which does its configs in Haskell as well. I love Haskell its just I don't want it to be my config language
Re:How Nix and NixOS get so close to perfect by stavros on Sunday April 24, 2022 @07:49AM (#31143166)
I don't think JSON is a nice way to write config files at all. You can't even add comments. I'd much prefer something like Cue.
Re:How Nix and NixOS get so close to perfect by xena on Sunday April 24, 2022 @07:55AM (#31143203)
I think the hard part here is using enough of a type system to ensure data sanity but not so much of one that you drown in metadata. I'm not really sure of a proper compromise like that.
Re:How Nix and NixOS get so close to perfect by stavros on Sunday April 24, 2022 @07:57AM (#31143214)
Yeah, fair point. I don't know Cue well enough to know how much drowning there is, from my limited understanding you can specify as many types as you want and leave the rest dynamic, but I'm not sure at all.
Re:How Nix and NixOS get so close to perfect by dotancohen on Sunday April 24, 2022 @08:18AM (#31143345)
So long as the parser doesn't except on undefined keys, you can add pseudo-comments to many places in a JSON config file.

  {
    "foo": "bar",
    "COMMENT": "This bars the foo"
  }
Re:How Nix and NixOS get so close to perfect by viraptor on Sunday April 24, 2022 @09:03AM (#31143561)
That still doesn't let you comment on items in the list, or on elements of actual maps - for example if those were environment variables, now you've got a random "COMMENT" variable.
Re:How Nix and NixOS get so close to perfect by dotancohen on Sunday April 24, 2022 @10:59AM (#31144640)
Sure, it's a hack, but it's a useful hack that works in many places.
Re:How Nix and NixOS get so close to perfect by ithkuil on Sunday April 24, 2022 @08:22AM (#31143359)
If it doesn't error in undefined keys you cannot help people figuring out when they introduced a typo in their config