5 ms·
I thought I started to understand flakes, but now I feel clueless again.
by mongol 3y ago
I thought I started to understand flakes, but now I feel clueless again.
- zamalek 3y agoWhat are you struggling with? I've become okay at Nix and flakes - so maybe I can help understand.
- mongol 3y agoWhat does this enable that will be useful to me as a user?
- rq1 3y agoBetter tooling, simpler interfaces, better error reporting, validation… etc.
- res0nat0r 3y agoI'm using NixOS again after installing it years ago and enjoying it, but I still have a real hard time understanding just how to somehow implement or use a flake, or create a useful new package with it that isn't in the nixpkgs repo already. I still find much of the syntax incredibly confusing and hard to just get simple concrete self contained examples, or without worrying if this is intermingled with some non flake code somewhere that isn't compatible. I've bumped a few nix packages via github PR's and can hack around a bit with existing things I see upstream, but knowing how to do everything is still confusing. I guess I need to sit down and read all of https://zero-to-nix.com/ https://zero-to-nix.com/ and see if there is anything I'm missing.
- grhmc 3y agoThis is a deeper cut of pretty foundational stuff. Almost no user will need to actually interact with schemas, and instead will use schemas provided by other folks. In other words, if this doesn't make sense: don't worry, you don't need to know about it :). The tl;dr, though: * nix flake show and other tools only knew about very specific types of things you might put in a flake. * with flake-schemas, that limitation is lifted and people can do more creative things.
- jljljl 3y agoFlakes have a set of default outputs they can generate, like packages, devShells, templates, and NixOS configs. Nix knows how these outputs work and can validate them using `nix flake check`, or list them with `nix flake show` But what if you want your flake to output a library? A Dockerfile? A Terraform or Kubernetes config? Nix doesn't know about those custom outputs, and doesn't have a way to validate that you're using them correctly. Now with Flake Schemas, you can provide a schema so that built in tools like `nix flake show` and `nix flake check` can properly validate the new output. This makes it easier for Flake developers to communicate the interface of their custom output to Flake consumers
- alexeldeib 3y agoI’m modestly familiar with nix. I’ve written flakes and some other derivations. I’ve dabbled with overlays and such but I’m not super familiar. I liked flakes enough I created a template repo for packaging dev envs. Until this post/your comment I didn’t know flakes could even have custom outputs. I guess they’re all just conventions for attribute names, and everything is a derivation, so it makes sense. But realizing that point was key, even with passing nix familiarity.