Power of Nix but it's YAML (macOS and Linux)

(namios.dev)

23 points | by jktyjvhubb a day ago ago

27 comments

  • soraminazuki a day ago

    The Nix expression language is a really good configuration language. The syntax that you have to learn is minimal, while being able to express complex configurations in a maintainable manner.

    Contrast that with YAML. YAML-heavy ecosystems can't handle even modestly large configurations. Just look at the Kubernetes ecosystem. Its solutions for handling complexity are Kustomize and Helm templates. Both of which add even more complexity while decreasing flexibility and expressiveness. It's just not possible to make large-scale JSON data more maintainable with just syntax, like YAML does. There needs to be primitives for building abstractions, like functions.

    So on the website, the given examples are things like writing down the list of packages that you want. But I can do much more with Nix. Like applying unreleased patches to a package. Or creating a custom package on the fly and embedding its path in a file. Or installing multiple browsers, all with uBlock Origin installed and configured with the desired filter lists plus custom block rules. Or set up a project-local PostgreSQL database initialized with a script file contained in another package. Nix provides me with the primitives to do what I want to achieve in any particular situation, while YAML based tools only gives me a few configuration points for predefined workflows.

  • astralkraft a day ago

    Too little too late.

    Conda is taking over, and it has simple toml tools available from the very beginning of it's rise in popularity.

    https://pixi.prefix.dev/

    In raw users, outside of echo chambers in DevOps, Conda Forge has already won (Facebook money), and the tooling natively works equally well across Windows, MacOs, and Linux.

    Nix needed something like this 3-4 years ago

    • KolenCh 19 hours ago

      That’s not true. They can be quite similar in some sense, but are fundamentally very different. Nix is a functional package manager, conda is not. Nix packages include system packages (an entire OS can be distributed using that), conda has some but very limited. One thing conda is very good at is the arbitrary prefix design, making it deployable everywhere (on system you don’t have full control), and nix has a hardcoded prefix that often get in the way to make it available everywhere. So where nix is used does not depends on having a YAML config at all. Having it 5 years earlier or later won’t meaningfully change adoption. (Ie it is second order effects.)

    • astralkraft a day ago

      There's other tools as well:

      https://mise.jdx.dev/

      Conda support. No special hoops to jump through on Mac or Windows either.

      Convince me, why should I go back to using Nix at work in a mixed workstation environment? Why should I use a system based on a boutique language that's not transferable to any other domain, rather than write a TOML config?

      • thiagogonzagade a day ago

        i develop on windows, so this is the first thing i check. nami’s site says it is for linux and macos, and the installer says it runs on linux and on macs for now, i didn’t see windows. in a mixed team that already makes it hard to use, more than yaml vs nix.

      • abrookewood a day ago

        Mise is excellent.

    • nylonstrung a day ago

      I don't think Nix and Conda are direct substitutes for each other, nor that it is "losing". Nix has 5x the number of packages and focused primarily on binaries

    • Cyph0n a day ago

      Conda has taken over Nix? Is this in some specific niche industry, or do you mean generally?

      Because I don’t see how that would ever be the case based on package repo size along with the fact that Conda doesn’t allow you to build a distro from scratch.

      • astralkraft a day ago

        In software generally. Nix never escaped the DevOps niche, and I dislike it even there too. Conda is used on Windows, like it or not.

        Are you arguing more people use Nix than Conda?

        I don't know what building a distro "from scratch" means to you, but when I build an immutable installation, I don't use Nix to do it. Professionally, Ignition is my choice.

        You're splitting hairs. Are we talking distros or environments? I admit, Nix goes after every domain, and does all of them pretty badly, but that's never been the point. The discussion was about cross platform environments.

        • Cyph0n a day ago

          Agreed, it depends on what we’re talking about. Nix is definitely wider in scope which is actually a differentiator for many of us: it’s quite powerful to be able to specify all of your builds, dev envs, packages, and distros from a single shared config.

          My impression was that Conda is more popular in the Python world, especially in scientific computing and ML. I personally don’t hear of Conda ever being used outside of these fields, but I would love to be corrected.

          Looking at the submission, this thread seems to be focused on two areas: reproducible build systems and dev environments.

          For a general purpose reproducible build system, Bazel is probably king at this point, but Nix is a player here too. Dev environments are more fragmented: some just stick to language-specific tools, some use Docker containers / Docker Compose, some use Nix, and of course there are other options such as Conda.

          In neither of these areas would I ever think that Conda has “already taken over”, hence my confusion :)

    • riedel a day ago

      I don't know if conda has won. I am seeing exactly the opposite around me. People have moved away from conda. I myself ended up using nixos and devenv. Not caring to much about syntax as most stuff I get stuck can be inferred by an LLM.

      • astralkraft a day ago

        I prefer not needing to get stuck in the first place, especially when I have work to do

        • riedel a day ago

          This was only for figuring out nix syntax. In the end nix and particularly nixOS is much more expressive.

          So I would agree, that one does not want to get stuck overall, but point to the many times conda would not do due to either not being able to resolve either conflicts or wrapping more complex stuff.

    • soraminazuki a day ago

      You're free to use whatever tools that suit you, but there's no need to throw in personal insults like you're doing everywhere in your replies:

      > Nix was created out of false statements repeated en masse. That's why it has the reputation of a cult.

      By all means give us informed opinions. But if you feel the need instead to respond with an apples-to-oranges comparison or semantic dodges like the one below, maybe not do that too.

      > If expressiveness was the be all end all, we would all still be using using Ruby on Rails

      Because, come on. The expressiveness in the context of Nix is about the scope of what it can do, not Ruby's expressiveness of having multiple ways to write the same thing.

  • ktpsns a day ago

    This is somewhat similar to https://cloud-init.io/ , an established standard to spin up new VMs/VPS from local KVM to cloudy land. In its simplest form it is a YAML file looking very similar to namios.

  • vivzkestrel a day ago

    - sorry i dont get it, is this a brew.sh alternative?

  • aeve890 a day ago

    I know yaml is constantly trashed as unfit for configuration and almost always one would be better with a proper procedural language but this looks so clean next to nix I can't wait to give a try.

    • soraminazuki a day ago

      Procedural languages are the last thing you want for large-scale configuration. It's difficult to reason about mutable variables changing over time, especially when the final result is just static data.

      Declarative languages are much better suited to this. You want to think about the dependencies between values, not the intermediate state of an unfinished configuration.

  • zamalek a day ago

    Replacing Nix with YAML (of all possibilities) is certainly a choice. I guess TOML was already taken as a porcelain.

    Maybe I will use some tokens to make a brainfuck porcelain this weekend.

  • max-privatevoid a day ago

    This is not the first yaml2nix thing, and it's unfortunately probably not the last, but AFAIK all the yaml2nix things before it have failed. Are some people really this averse to learning JSON, but swap ":" with "=", and "," with ";"?

  • TheFuzzball a day ago

    "Jeez this YAML is verbose and unwieldy, maybe I need some sort of meta language to clean this up?" Oh...

  • d3Xt3r a day ago

    Unfortunately the problem with using Nixpkgs is that packages there are often behind upstream, or even completely non existent.

    For eg, ardour on Nixpkgs is still on 9.10, whereas on Arch it's at 9.11. Muse is on 4.2.1 vs 4.3.1 on Arch. dua is two releases behind (3.0.3 vs 3.1.1 on Arch). uv is even worse, it's three stable releases behind Arch (0.13.10 vs 0.13.13).

    And Lemonade doesn't even exist in Nixpkgs, whereas it's a regularly maintained repo package in Arch!

    So what's the point in boasting that you've got 150k packages?!

    So as an Arch user, I don't see why I should use Nixpkgs and suffer dealing with outdated or non-existent packages.

    • mpalmer a day ago

      Do you use nix regularly? These are not problems one expects to hear from a practitioner.

      The last thing you want is a stable channel tracking the bleeding edge... you have the unstable channel for that.

      150k is by far the highest number of packages offered by any package manager. I don't think that's in dispute.

      Use what you want, always! But it is almost always trivial to specify the packages yourself wherever you need to depend on them, or find someone else's flake who has already done the same.

      • d3Xt3r a day ago

        I used to use Nix regularly, before I gave up on it completely because of the outdated packages issue. To be specific, it was around when FreeRDP 3.0 came out - it took something like a ridiculous 6 months or so before it hit the repos. And no, it wasn't on the unstable channel either.

        Btw, I just checked and the newer package versions aren't present on the unstable channel either, so my point still stands.

        • mpalmer a day ago

          This ignores the other part of my point, which is that writing a custom package that builds what you want is trivial.

  • ProphetOfParado a day ago

    I use Nix _because_ I hate YAML btw.