3 ms·
I’ve said it before: Nix is advanced alien technology that was badly damaged when it crash landed on Earth. We’ve got a very nice setup that deeply integrates
by benreesman 4y ago
I’ve said it before: Nix is advanced alien technology that was badly damaged when it crash landed on Earth.
We’ve got a very nice setup that deeply integrates Nix/NixOS/Bazel (working name “straylight” for the Gibson fans) that builds most major languages well and rounds off the (very) rough corners. I’m dying to open source it but it takes time to detangle that kind of thing from your proprietary stuff. I paid in blood to know Nix inside out and I don’t want any more people to do that than already have. We use Tweag’s shit for some of the Haskell stuff.
Until then: if you’re ready to pay the price of learning this shit: you’ll get a favorable exchange rate by reading the source of nixpkgs. The docs/blogs are just usually wrong. There are exceptions (Xe is a baller), but mostly you’re flipping a coin whether or not an online resource will move you forwards or backwards.
Edit: Flakes aren’t an experimental new feature. They are a desperately needed fix to a badly broken status quo. Do not pass go, go directly to flakes.
- runeks 4y ago> Edit: Flakes aren’t an experimental new feature. https://nixos.wiki/wiki/Flakes https://nixos.wiki/wiki/Flakes tells me to enable Flakes by adding “flakes” to the config option named “experimental-features”...
- benreesman 4y agoYou’re absolutely right. Exhibit #902353 in “Why Everything About Nix on The Internet is Wrong”. Haskell used to have a semi-official motto: “Avoid success at all costs”. I think they were joking. Docs/UX that bad makes one wonder if the Nix people took that to heart. Flakes being some weird shoulder-surgery to even turn on? Why don’t we save time and just kick the ball into our own goal over and over. Le sigh.
- otabdeveloper4 4y agoToo many corner cases don't yet work properly in flakes for it to be the default. I think we can wait a few more months until they become stable enough.
- benreesman 4y agoEducate me a little about the corner cases? I’ve long since adopted a philosophy I call “Kool-Aid Man Programming” named after ad advert when I was a kid of the character jumping through walls. If something doesn’t work I write my own derivation and patches if necessary, if the utilities for that ecosystem don’t work I write new ones, I just don’t take no for an answer from Nix. I find this to be faster and less stressful than engaging with maintainers. Perhaps for more casual users it’s still a bad default? Even that doesn’t tie out with my personal experience. A year ago flakes were already default amongst the serious pros, now if I don’t see a flake.nix I assume I stumbled into the old repo.
- otabdeveloper4 4y agoThis thing, for example: https://github.com/NixOS/nix/issues/3121 https://github.com/NixOS/nix/issues/3121 Or the issues surrounding submodules.
- benreesman 4y agoThere are a lot of remarks on that issue, so maybe the plot thickens somewhere along the way, but if I’m reading that right, the corner case is that the first time a flake is somehow reified into the store, I’m hitting the filesystem with exactly what would happen if I ever referenced it elsewhere? So in practice I’m eating the cost of “installing” it the first time I use it, which is subsequently amortized across all the other times I use it? And if I’m really worried about this, my flake hits a default.nix in a directory that can also have a shell.nix I’m it so I can get around this? I think Einstein once said: “However great your troubles with mathematics are: be of good cheer. I assure you mine are far greater.” Nix isn’t relativity and I’m no Einstein, but if you work in Nix world and that issue even rises to your notice? Let’s trade jobs because I fucking wish I had Nix problems like that.
- wocram 4y agoHow are you integrating bazel and nix? My assumption is that bazel is running in an environment created by nix, so I wonder what you mean by 'deeply integrated'.
- benreesman 4y agoThe devil as always is in the details, but in the broad strokes we have a pretty uniform/composable way to float stuff from the Nix store into Starlark and thereby put all of nixpkgs within Bazel’s reach. Doing like custom Bazel cc_toolchain stuff against Nix wrappers is, uh, an adventure. But you grind away at it and now you’ve got the C toolchain you want. Wash/rinse/repeat for all the other languages you use and before you know it you’ve got Nix’s determinism and Bazel’s crazy fast build times. When I was at FB there were dozens if not hundreds of serious hackers working on this sort of thing, and they were fucking good at their jobs, but technology usually moves forward with time and this setup smokes where FB was at in 2018. I don’t know what they’re up to now, I bet it’s good.
- wocram 4y agoI have spent a little bit of time working on a prototype of a setup like this, and have needed to write a lot of (hacky) glue and BUILD files. I take it you have departed quite a bit from https://github.com/tweag/rules_nixpkgs https://github.com/tweag/rules_nixpkgs ? Are you generating BUILD.bazel files for nixpkgs, or are you doing that by hand?
- atom_arranger 4y agoLearning about these kinds of things is one thing motivating me to try for a big tech company job. I want to build my own company, but I want it to have this kind of tooling, that I don’t fully understand yet. Sounds really interesting, would love to see it used more.
- benreesman 4y agoI don’t know what the conventional wisdom is these days, but speaking for myself, I felt much more equipped to tackle the huge undertaking of being more entrepreneurial after seeing how a really serious software shop is run. As for getting the big company job, it’s a weird time over like the last two months and the next two months, but this will soon pass. Everyone hates leetcode interviews. I hated being interviewed in that format, and I hated interviewing in that format. It is what it is. It’s a test like the SAT or LSAT or GMAT or anything, arguably not as hard. It’s basically nothing to do with the job at the lower seniorities. I think people would be less psyched out about it if they viewed it the same as cramming for any other test. A high score on the LSAT doesn’t make you a good lawyer, it’s a loose proxy metric at best, and you game it by studying. By virtue of a) hanging out on HN and b) hanging out in a thread about Nix you’re clearly curious and paying attention, so go get that marquee job, and take the experience with you when you start your venture! I’ll be rooting for your success!