Live data from Hacker News

Why did Nix adopt Flakes?

jetpack.io

31–40 of 68 posts

Re: Why did Nix adopt Flakes?

#31

Earlier quoted context omitted.

Doesn't this still copy the repo, but just doesn't unzip it?

I think it only lazily copies files that are referenced by your nix expression. I tested this branch, and a flake-based shell launched in 3 seconds inside a large monorepo (vs 30 seconds before). I don't think it is possible to copy this repo in 3 seconds.

I hope that helps with nixpkgs repo as this takes a lot of time whenever it is updated.

Re: Why did Nix adopt Flakes?

#32

This probably goes against the flow, but I tried NixOS on a VPS and I found the tools to be inscrutable. Was so confused about Nix packaging and whether to use Flakes.

Depends on the person. I work in a company that uses Nix for everything one could possibly imagine, and I've found there are a few types of people: 1. The purist: Is on an actual crusade to promote Nix and stomp out any competition, because, "reproducible." 2. The enthusiast: Likes using Nix to speed up development but recognizes it has a ton of shortcomings, among others being not friendly to beginners, and tends to…

We use it for devshells, and it’s awesome. New devs install nix and direnv and they instantly have all the right versions of all of our tooling. A first day setup process is now done in minutes instead of a day. Flakes made it possible for us to package up internal and external tools and ensure consistency across a team.

I have no experience running it in production, but I imagine if you don’t want to use containers it’d be a pretty good option.

Re: Why did Nix adopt Flakes?

#33
the article does a good job of explaining why something like the flake system was necessary, but man oh man does the particular thing we wound up with have issues.

you can smell from a mile away that they were engineered to solve widely-experienced problems... as experienced by a single company, with an existing, idiosyncratic set of methodologies. and they just happened to get the blessing because eelco was at that company. unlike nix proper, however, where eelco had the entire internet for feedback, the core design of flakes ossified before the world at large had reason to care about them.

it doesn't help that nix's command-line ux is currently super splintered as a result, and while that will be ironed out in the long run, the thing in the name of which those tools got splintered is rather insulting.

i love nix but god damn this is the stage at which i'd take someone to couples counseling

Re: Why did Nix adopt Flakes?

#34

So, did Nix actually adopt flakes ? Because last time I checked, it was still an experimental feature that everyone insists on using, but… it's still experimental, which means you have to make effort to use it.

The thing with nix is that features are experimental for a very long time, even though they are quite solid. It seems like it is mostly used so they can still make changes, like the CLI options or the names of attributes in the flake. The effort to use it is just adding extra line to the config.

Re: Why did Nix adopt Flakes?

#35
Am I the only one completely confused by the examples that appear to put command line arguments after shell end-of-line comments? Is that not a typical shell?

example:

  nix run .#cowsay -- flakes are neat
Some explanation of what the heck this means would be really useful.

Re: Why did Nix adopt Flakes?

#36

Am I the only one completely confused by the examples that appear to put command line arguments after shell end-of-line comments? Is that not a typical shell? example: nix run .#cowsay -- flakes are neat Some explanation of what the heck this means would be really useful.

"--" isn't anything special in a typical shell. It's just another argument, one that customarily means "pass the rest of arguments on to a subprocess". Or are you confused about the "#"? It doesn't start a comment in the middle of a token.

Re: Why did Nix adopt Flakes?

#37

Am I the only one completely confused by the examples that appear to put command line arguments after shell end-of-line comments? Is that not a typical shell? example: nix run .#cowsay -- flakes are neat Some explanation of what the heck this means would be really useful.

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1...

The first -- argument that is not an option-argument should be accepted as a delimiter indicating the end of options. Any following arguments should be treated as operands, even if they begin with the '-' character.

Re: Why did Nix adopt Flakes?

#38

Am I the only one completely confused by the examples that appear to put command line arguments after shell end-of-line comments? Is that not a typical shell? example: nix run .#cowsay -- flakes are neat Some explanation of what the heck this means would be really useful.

yikes! thanks for pointing that out. The blog's renderer is confused too and renders the `#cowsay -- flakes are neat` as a comment.

To explain what's happening:

- The example above is running `nix run -- `.

- The `` here is `.#cowsay`, which is to be read as: `#`. The # is a separator here.

- The `` being `.` implies its a local flake at the current directory. The `` in this case is the output from the flake i.e. the `cowsay` program.

further fun to be found at: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix....

As a meta-comment, yeah, this is kinda non-trivial for most of us. This is why we build devbox which provides a more familiar UX like `devbox add cowsay && devbox run -- cowsay "flakes are neat"`

Re: Why did Nix adopt Flakes?

#39

So, did Nix actually adopt flakes ? Because last time I checked, it was still an experimental feature that everyone insists on using, but… it's still experimental, which means you have to make effort to use it.

Even after it passes the experimental stage, I doubt they'll drop support for the default install/config method using configuration.nix. Flakes will just another option but not required.

Re: Why did Nix adopt Flakes?

#40
post #32

Earlier quoted context omitted.

Depends on the person. I work in a company that uses Nix for everything one could possibly imagine, and I've found there are a few types of people: 1. The purist: Is on an actual crusade to promote Nix and stomp out any competition, because, "reproducible." 2. The enthusiast: Likes using Nix to speed up development but recognizes it has a ton of shortcomings, among others being not friendly to beginners, and tends to…

We use it for devshells, and it’s awesome. New devs install nix and direnv and they instantly have all the right versions of all of our tooling. A first day setup process is now done in minutes instead of a day. Flakes made it possible for us to package up internal and external tools and ensure consistency across a team. I have no experience running it in production, but I imagine if you don’t want to use containers…

for devshells use https://devenv.sh
Post reply on HN