7 ms·
Why We're Moving on from Nix
- lloydatkinson 1y agoAs someone with only a little experience with Nix, the points here don’t really seem right? > This approach isn’t clear or maintainable, especially for contributors unfamiliar with Nix’s version management. > For languages like Node and Python, we ended up only supporting their latest major version. What is not maintainable about this? That they need to make a list of available versions? So, can this not be automated? Furthermore, why is Railway defining how a user uses Nix? Surely one of the points of Nix is that you can take a bare machine and have it configured with exactly what versions of packages you want? Why would Railway need to get in the way of the user and limit their versions anyway? Or did I misunderstand and they don’t even expose Nix to the user? If so, the original question still stands: can’t they automate that list of package versions?
- codethief 1y ago> Or did I misunderstand and they don’t even expose Nix to the user? That's at least my understanding, yes.
- notnmeyer 1y agoyou can not have a dockerfile in your project at all, push your code to them, and they’d build an image for it with nixpacks. you’d see nix stuff in your build logs, but it’s behind the scenes for the most part.
- elbear 1y agoThe version limits come from the fact that the Nix cache doesn't maintain older versions. So, if you use an older version, you will have to compile from sources. It sounds like they didn't want to take it upon themselves and provide a cache with older versions, even though it doesn't sound like much effort. Honestly, the reasons given don't feel very solid. Maybe the person who introduced Nix left and the ones remaining didn't like it very much (the language itself is not very nice, the docs weren't great either in the past). Still, I'm not familiar enough with the stack they chose, but does it provide a level of determinism close to Nix? If not, it might come to bite them or make their life harder later on.
- e3bc54b2 1y agoNix cache (cache.nixos.org) does in fact maintain older versions[0]. In fact, they maintain so much older stuff (binaries and associated source), that they are used in both research[1][2] and are having issues with gigantic cache size[3][4]. And yes, their reasoning implies NIH and just unfamiliarity combined with unwillingness to really understand Nix. [0]: https://discourse.nixos.org/t/how-long-is-binary-cache-kept-on-cache-nixos-org/11210 https://discourse.nixos.org/t/how-long-is-binary-cache-kept-... [1]: https://hal.science/hal-04913007 https://hal.science/hal-04913007 [2]: https://luj.fr/blog/is-nixos-truly-reproducible.html https://luj.fr/blog/is-nixos-truly-reproducible.html [3]: https://discourse.nixos.org/t/nixos-foundations-financial-summary-a-transparent-look-into-2022/28107/16 https://discourse.nixos.org/t/nixos-foundations-financial-su... [4]: https://discourse.nixos.org/t/the-nixos-foundations-call-to-action-s3-costs-require-community-support/28672?page=7 https://discourse.nixos.org/t/the-nixos-foundations-call-to-...
- mplanchard 1y agoEven if this weren’t true, setting up their own binary cache on S3 would have been trivial. It took me half a day to get it set up for our CI pipeline.
- akho 1y agoNix cache does provide old versions. What they seem to want is old versions built with new versions of dependencies. That's also possible, but you will have to build things.
- cormacrelf 1y agoFrom the article: > The way Nixpacks uses Nix to pull in dependencies often results in massive image sizes with a single /nix/store layer ... all Nix and related packages and libraries needed for both the build and runtime are here. This statement is kinda like “I’m giving up on automobiles because I can’t make them go forward”. This is one of the things Nix can do most reliably. It automates the detection of which runtime dependencies are actually referenced in the resulting binary, using string matching on /nix/store hashes. If they couldn’t make it do that, they’re doing something pretty weird or gravely wrong. I wouldn’t even know where to start to try to stop Nix from solving this automatically! I wouldn’t read too much into their experience with it. The stuff about versioning is a very normal problem everyone has, would have been more interesting if they attempted to solve it.
- mplanchard 1y agoTo be fair to the authors, this IS a problem, albeit one they phrased poorly, especially with building docker images via nix. The store winds up containing way more than you need (eg all of postgres, not just psql), and it can be quite difficult to patch individual packages. Derivations are also not well-pruned in my experience, leading to very bloated docker images relative to using a staged Dockerfile. Image size isn’t something we’ve focused a lot on, so I haven’t spent a ton of time on it, but searching for “nix docker image size” shows it to be a pretty commonly encountered thing.
- mrbluecoat 1y ago> we don’t have any problem with Nix itself. But there is a problem with how we were using it. A good example of 'use the right tool for the right job'. Nix is great for some use cases and awful for others. The problem is the Nix learning curve is so high that by the time you've grasped it enough to make a decision you feel you've invested too much time to back out now and pivot to something else so you try to shoehorn it to solve the original need.
- teekert 1y agoI feel it like that as well, but in some ways Nix is a more normal programming paradigm than other OS’s. We’re just not used to thinking about an OS that way. Nix expressions have inputs (a package repo, lots of key-value pairs) and outputs (a Linux system). Idk perhaps in a couple of years it will be much more normal. Ie it is very easy for an AI to create a to-spec shell.nix (some Python packages, some Linux packages, some env vars, some path entries etc), or configuration.nix because of this paradigm. I do this a lot to include envs with repos that fully support the package. It would probably be more reproducible with flakes (a flake.nix is like a shell.nix but with version pinning… or something, I’m still climbing that learning hill).
- zxexz 1y agoI often find it takes about 10 minutes of my time to package your average python package into nix, or 1 minute if its pyproject.toml based (uv/poetry projects!. There is a long tail though (cough weasyprint cough).
- gf000 1y agoThat's mostly just a tooling issue/a paradigm mismatch. Python's package management is notoriously bad, so it sorta makes sense that it won't fit as nicely with Nix.
- throwaway314155 1y ago> Python's package management is notoriously bad, so it sorta makes sense that it won't fit as nicely with Nix This sort of thing is immaterial to users of Nix/Python who just want it to do the god damn thing it's supposed to do.
- viraptor 1y agoThe version selection part sounds weird. The versions in nixpkgs make sense when you're running/building the system. If you're providing runtimes/compilers as a platform, you really want something like what devenv does - provide the versions yourself. You really don't want to end up building an old system to provide an old nodejs - you're leaving security patches in dependencies behind. Devenv does it for example through https://github.com/cachix/nixpkgs-python https://github.com/cachix/nixpkgs-python "All Python versions, kept up-to-date on hourly basis using Nix." > Railway injects a deployment ID environment variable into all builds. They could've done it in the next layer after installation. Also, you can split packages into different layers. There's even automation for it if you need batches to keep the number of layers down.
- ris 1y agoThe main problem here is wanting to hang on to the "bespoke version soup" attitude that language package managers encourage (and is totally unsustainable). The alternative Mise doesn't appear to have any ability to understand version constraints between packages and certainly doesn't run tests for each installed package to ensure it works correctly with the surrounding versions. So you're not getting remotely the same thing.
- k__ 1y ago"the "bespoke version soup" attitude that language package managers encourage" Care to elaborate what that means and what the alternative is?
- matthewbauer 1y agoNot sure on the exact take of the OP, but: Package maintainers often think in terms of constraints like I need a 1.0.0 <= pkg1 < 2.0.0 and a 2.5.0 <= pkg2 < 3.0.0. This tends to make total sense in the micro context of a single package but always falls apart IMO in the macro context. The problem is: - constraints are not always right (say pkg1==1.9.0 actually breaks things) - constraints of each dependency combined ends up giving very little degrees of freedom in constraint solving, so that you can’t in fact just take any pkg1 and use it - even if you can use a given version, your package may have a hidden dependency on one if pkg1’s dependencies, that is only apparent once you start changing pkg1’s version Constraint solving is really difficult and while it’s a cool idea, I think Nixpkgs takes the right approach in mostly avoiding it. If you want a given version of a package, you are forced to take the whole package set with you. So while you can’t say take a version of pkg1 from 2015 and use it with a version of pkg2 from 2025, you can just take the whole 2015 Nixpkgs and get pkg1 & pkg2 from 2015.
- 0xbadcafebee 1y ago> Constraint solving is really difficult and while it’s a cool idea, I think Nixpkgs takes the right approach in mostly avoiding it. If you want a given version of a package, you are forced to take the whole package set with you. Thank you, I was looking for an explanation of exactly why I hate Nix so much. It takes a complicated use case, and tries to "solve" it by making your use-case invalid. It's like the Soylent of software. "It's hard to cook, and I don't want to take time to eat. I'll just slurp down a bland milkshake. Now I don't have to deal with the complexities of food. I've solved the problem!"
- kesor 1y agoLooks like they are trying to force versions into where there are none. Just like trying to force a square cube into a round hole. "Default versions" breaking things that depend on them? What is that? It is like using docker's ":latest" tag and being surprised each time that a new server falls on its face because the "default" image is actually a different version from the previous "default" image. I don't understand any of the explanations in this blog post. Seems like people who have zero clue about what a "version" of a software is. "no way of splitting up the Nix dependencies into separate layers" - Why? Of course you can split /nix/store into as many layers as you need. Do they even know how to use containers and how to use Nix in the first place? With the clear incompetence of these people, no wonder that their proposed solution smells like a decomposed fish. Classic NIH syndrome. There is going to be no surprise to see them meet the exact same problems they didn't solve with Nix to infest their new "solution".
- jbverschoor 1y agoWhat works better to raise VC (which for many is the goal) A nix wrapper or a deployment platform
- BoorishBears 1y agoTraction. I don't think any VC worth the time is going to sit around nitpicking how much Nix matters to their offering if they're making increasing amounts of money.
- jbverschoor 1y agoDepends who’s pretending to be a VC, or accelerator
- kesor 1y agoIt works best to post your "solution" on hacker news and get roasted by ALL the commenters who have a clue while you have none.
- 12_throw_away 1y ago
- Cloudef 1y agoI dont see why they couldnt made their own derivations instead of relying on nixpkgs hashes.
- deleted 1y ago[deleted]
- droelf 1y agoWe've been working on Pixi, which uses Conda packages. You can control versions precisely and also easily build your own software into a package to ship it. Would be curious to chat if it could be useful as an alternative to `mise`.
- setheron 1y agoNix gives you a commit guarantee rather than arbitrary versions. You're going to put yourself in a bad time when you have edge cases: glibc changes or conflicting shared libraries. It sounds like it's a little bit too late, but I'm happy to provide some consulting on how you can get it to work idiomatically with Nix. Product looks cool!
- nialv7 1y agonix solves the shared library incompatibility problem by being extremely conservative. every time anything changes, consequential or not - a comment got modified, documentation changes, a testcase got added, etc. - it will rebuild all dependents. and not just that, but all dependents of dependents, and dependents of dependents of dependents, on and on. this often results in massive massive rebuilds. sure you are not going to get shared library conflicts, but i think this solution is extremely wasteful, and can make development painful too - look at nixpkgs' staging process.
- smilliken 1y agoThe reason someone changes a dependency at all is because they expect a difference in behavior. No one would feel the motivation to go update a dependency if they aren't getting something out of it, that's a waste of effort and an unnecessary risk. Each person doesn't have to perform the build on their own. A build server will evaluate it and others will pull it from the cache. The greater waste that nix eliminates is the waste of human time spent troubleshooting something that broke in production because of what should have been an innocent change, and the lost business value from the decreased production. When you trust your dependencies are what you asked for, it frees the mind of doubt and lets you focus on troubleshooting more efficiently towards a problem. Aside, I spent over a decade on Debian derived distros. I never once had one of these distros complete an upgrade successfully between major versions, despite about 10 attempts spread over those years, though thankfully always on the first sacrificial server attempted. They always failed with interesting issues, sometimes before they really got started, sometimes borking the system and needing a fresh install. With NixOS, the upgrades are so reliable they can be done casually during the workday in production without bothering to check that they were successful. I think that wouldn't be possible if we wanted the false efficiency of substituting similar but different packages to save the build server from building the exact specification. Anything short of this doesn't get us away from the "works on my machine" problem.
- femiagbabiaka 1y agoThe new design is very similar to Dagger, interesting.
- wg0 1y ago> We also changed the codebase from Rust to Go because of the Buildkit libraries. Go is the best choice at the moment for such tools. These tools start a process, do lots of IO and exit. Very pragmatic choice.
- Onavo 1y agoGo also statically links all dependencies and reinvents all the wheels usually provided by the system land. Cross compilation is trivial. It is unrivaled when it comes to deployment simplicity.
- xvilka 1y agoRust does the same.
- hu3 1y agoYea and at least Go provides a giant Google engineering tier quality standard library so reinventing the wheel here doesn't hurt so much productivity. Meanwhile Rust requires a pile of variable quality community driven crates to do basic things.
- bigyabai 1y agoBoth languages have enormous cargo-culting issues when you try to do anything that isn't fizzbuzz. The bigger difference that I'd expect people to identify is that Rust generates freestanding binaries where Go software requires a carefully-set runtime. There are pros and cons to each approach.
- hu3 1y agoNone of them generate true freestanding executables by default. Both Go and Rust require glibc. And Go's runtime is built-in by default. Unlike Java so there's nothing to "carefully set".
- eviks 1y agoCouldn't quickly find the blog introducing nixpacks, but weren't these issues clearly visible from the start? > Smaller Builds > Better caching what were the benefits that overcame this, and what about those now?
- jchw 1y agoOkay I'm a Nix enthusiast but you'll have to trust me when I say that I'm not criticizing them for moving away from Nix; it isn't that strong of an emotional attachment. However, I'm not really sure I understand some of these complaints and they really could use more explanation. For example: > The biggest problem with Nix is its commit-based package versioning. Only the latest major version of each package is available, with versions tied to specific commits in the nixpkgs repo. While Nixpkgs is an amazing resource, Nix != Nixpkgs. Nixpkgs is highly unideal for cases where you want to be able to pull arbitrary versions of toolchains, but it is not the only way to go. For example, there is amazingly good Nix tooling for pulling an arbitrary version of Rust. Other Nix-based developer tools have shown how you can do this well. > no way of splitting up the Nix dependencies into separate layers That doesn't make any sense. You can literally just split them into separate layers in whatever arbitrary fashion you'd like. The built-in Nixpkgs docker tooling has some support for this even. > We also changed the codebase from Rust to Go because of the Buildkit libraries. This part is not related to Nix, but I find it interesting anyways. Obviously most people don't transition programming languages on a whim, it's generally something you do when you're already planning on building from scratch anyways. To me it almost sounds like different people worked on Railpacks vs Nixpacks. (I've definitely seen what happens when people not familiar with Nix wind up having to deal with unfinished Nix solutions within an organization. It is not pretty, as most people are unwilling to try to figure out Nix. I don't generally use Nix at work out of fear of causing this situation.)
- cchance 1y agoHonestly this feels more like rail... wants to make their own version, hence a new railX lol
- imtringued 1y agoCorrect
- dleslie 1y agoI don't use Nix, however this seems dismissive: > While Nixpkgs is an amazing resource, Nix != Nixpkgs. If Nixpkgs is the default and alternatives require additional research and effort then for most users it _is_ Nix. > That doesn't make any sense. You can literally just split them into separate layers in whatever arbitrary fashion you'd like. The built-in Nixpkgs docker tooling has some support for this even. Is this obvious, simple, and default behaviour?
- foooorsyth 1y ago>The biggest problem with Nix is its commit-based package versioning. I am naive about Nix, but... ...isn't that like...the whole selling point of Nix? That it's specific about what you're getting, instead of allowing ticking time bombs like python:latest or npm-style glibc:^4.4.4 Odd to attach yourself to Nix then blog against its USP.
- grep_name 1y agoEh. I've been using nixOS for years now and still find that I often desperately, desperately wish I could upgrade just one program that I need a new version of without risking that, you know, any individial single one of my installed packages has a change between the last update and now that messes up my workflow. Or that I could pin a version of a software that I'm happier with that version of without essentially rolling my own package repo. It is, in fact, the only package manager I'm aware of that makes it such a pain to do that. It's only because people in this thread are insisting it's doable that I say 'such a pain' instead of just 'impossible'. A few weeks ago I needed to update firefox for a bug fix that was causing a crash, but of course that meant updating all of nixpkgs. When I finished the switch, the new version of pipewire was broken in some subtle way and I had to roll it back and have been dealing with firefox crashing once a week instead. I can't imagine pitching this to my team for development when I'm having this kind of avoidable issue just with regular packages that aren't even language dependencies. To those who say 'if you want to lock your dependencies for a project, you can just build a nix flake from a locked file using the <rust | python | npm> tools' I say, why the hell would I want to do that? Being able to manage multiple ecosystems from the same configuration tool was half the draw of nix in the first place!
- fucker42069 1y ago[dead]
- kesor 1y agoCreating overlays on nixpkgs is fairly trivial. There was a bug a couple of weeks ago with yt-dlp, which was fixed in the nightly version. But even today the new version is not yet available in nixpkgs-unstable. Did I wait all this time with a broken yt-dlp? No! I created a derivation that overrides the git commit of the original yt-dlp, and added it as an overlay to nixpkgs. Once nixpkgs has the newer version, I'll remove the overlay and customized derivation. This is a 5-lines-of-code change. You don't have to use flakes if you don't want to, it works without flakes as well. Now compare the above with how you would customize a version in other systems, like Debian with apt-pkgs ...
- awinter-py 1y agotldr we are moving on from nix because we are selling an alternative to nix?
- deleted 1y ago[deleted]
- lewo 1y ago> With no way of splitting up the Nix dependencies into separate layers nix2container [1] is actually able to do that: you can explicitly build layers containing a subset of the dependencies required by your image. An example is provided in this section: https://github.com/nlewo/nix2container?tab=readme-ov-file#isolate-dependencies-in-dedicated-layers https://github.com/nlewo/nix2container?tab=readme-ov-file#is... For instance, if your images use bash, you can explicitly create a layer containing the bash closure. This layer can then be used across all your images and is only rebuild and repushed if this bash closure is modified. > > pull in dependencies often results in massive image sizes with a single /nix/store layer This is the case for the basic nixpkgs.dockerTools.buildImage function but this is not true with nix2container, nor with nixpkgs.dockerTools.streamLayeredImage. Instead of writing the layers in the Nix store, these tools build a script to actually push the image by using existing store paths (which are Nix runtime dependencies of this script). Regarding the nix2container implementation, it builds a JSON file describing the Nix store paths for all layers and uses Skopeo to push the image (to a Docker deamon, a registry, podman, ...), by consuming this JSON file. (disclaimer: i'm the nix2container author) [1] https://github.com/nlewo/nix2container https://github.com/nlewo/nix2container
- schlarpc 1y agoJust wanted to say thanks for nix2container. I’ve been using it to do some deploys to AWS (ECR) and my iteration time between builds is down to single digit seconds.
- mplanchard 1y agoWe’ve had issues with docker image sizes and have been meaning to take some time to experiment with nix2container. Thanks for your work!
- rcarmo 1y agoHmmm. Interesting. I looked at the deployment file and... I'm doing a very similar thing, but with docker-compose and caddy: https://github.com/piku/kata/tree/compose https://github.com/piku/kata/tree/compose Completely different approach to dependencies, though. For now.
- api 1y agoNix strikes me as an incredibly well thought out solution to a set of problems that should not exist. The OS should be immutable. Apps and services and drivers/extensions should be self contained. Things should not be installed “on” the OS. This entire concept is a trillion dollar mistake.
- chpatrick 1y agoWell, what you're describing is NixOS.
- dnr 1y agoEverything you said "should" is exactly what Nix and NixOS is.
- cmrdporcupine 1y agoThe problem is that "should" is papered over a system not designed that way from the start, and in a heterogeneous world which operates in its own way, not Nix's way. So it's just an eternal battle between the real world and the fantasy Nix world, built on an army of thousands of volunteers writing up .nix files and contributing packages, and trying to tame the beast of Unix complexity. Except most of us are just trying to get things done and now I work in a shop where I can't even run a development setup with my favoured IDE, or just "cargo run" my package, because Nix has been placed in the middle of everything. Clearly in a sincere effort to tame complexity, but in the process creating a whole new world of it, with a lot of normative lifestyle assumptions. To me... in my experience... Nix promises a lot more than it can realistically deliver, comes with a totalizing world view, and in practice ends up making life more complicated unless you completely and totally buy into its way of doing everything, and are willing to leave many of your old tools and practices behind.
- api 1y agoThe right way to tame complexity is not that much of a hassle. This is why virtualization and containers have been so successful. Make the OS immutable by converting into a nested Russian doll of OSes with specific instances being mutable but also disposable. It’s ugly in its own way but it has the virtue of not exchanging one ugly complexity tax (OS rot and manual admin) with another (a complicated “manager” that wants to get in the way).
- deleted 1y ago[deleted]
- timeon 1y agoThis is not appropriate to post here but the site has nothing to do with railways.
- neuroelectron 1y agoNix seems to be being undermined internally. I wonder why that would be happening.
- brianjlogan 1y agoDo you have any more observations of this happening?
- neuroelectron 1y agohttps://x.com/jonringer117/status/1927872172514840677 https://x.com/jonringer117/status/1927872172514840677
- Aurornis 1y agoFrom the headline I thought they were making a single incremental change (Nix) but the article sounds like they’re doing an entire rewrite under a new project name: > Since we transitioned away from Nix, we also transitioned away from the name Nixpacks in favor of Railpack. We also changed the codebase from Rust to Go because of the Buildkit libraries. Suddenly the move away from Nix seems less like an incremental change and more like one part of a complete overhaul of the entire project. Did they have a team changeover or something? Or did they just want to start over from scratch and rewrite the whole project? It also seems strange to switch to an entirely different programming language for a single library. I haven’t found library FFI to be a huge obstacle in Rust.
- cybrexalpha 1y agoThat also jumped out to me as pretty weird. Buildkit as a library is nice, but there's no way it's good enough to justify throwing out the entire project. It feels like there was some big change internally, and the new team either wanted to rewrite and didn't know Rust, or ideologically prefer Go to Rust. Edit: Although looking at it, maybe not? Both the new project railpack[0] and the older one nixpacks[1] are both started by and mostly written by the same person[2], who is also the author of the article in question. So it doesn't look like a team change. It still feels... odd? Less that they made the change, projects go from Rust to Go all the time. But usually it's because of issues with Rust (hard to hire for, learning curve, etc.), describing it like this feels unusual? [0] https://github.com/railwayapp/railpack https://github.com/railwayapp/railpack [1] https://github.com/railwayapp/nixpacks https://github.com/railwayapp/nixpacks [2] https://github.com/coffee-cup https://github.com/coffee-cup
- fucker42069 1y ago[dead]
- miladyincontrol 1y agoNot to be dismissive either, but guix might have been more apt for what they wanted versus nix. Not trying to suggest guix is superior, just possibly a better solution considering their gripes with packages.
- jchook 1y agoFascinated by so many replies of "actually Nix does this just fine, you just have to be an expert like me"
- isbvhodnvemrwvn 1y agoIt's "the usual" when mentioning nix anywhere.
- kesor 1y agoWhen a company is writing all of their technology and business using, lets say JavaScript. And then they come here and post about them switching to some NIH home-brewed language instead because they couldn't understand how functions or arrays work. That is not a problem with the people commenting on their stupidity.
- IshKebab 1y agoYeah but if everyone was saying "I don't understand how functions or arrays work in Javascript", that's a pretty solid indicator that functions and arrays are badly designed in Javascript and are unnecessarily hard to understand. I think in some cases things are just fundamentally difficult and them being hard-to-understand is intrinsic. For example formal verification in Lean is hard to understand but I don't think Lean is badly designed. But it's hard to see why package management is one of those things. There are soooo many ways Nix could be easier to use and understand. The language itself is unnecessarily esoteric in my experience - compared to something like Starlark for example.
- cmrdporcupine 1y agoWelcome to the world of Nix. Just the latest in the line of "my totalizing world view will solve all your software problems" to which the answer of "this doesn't do what I want" is always "you're holding it wrong."
- alexpotato 1y agoIn my experience as a DevOps/SRE, I feel like every time someone tries to have a system to manage dependencies etc, its goes one of two ways (I'll use Python as an example): OPTION 1 "We'll have one big shared mono repo" Pros: - it's all in one place - it's "batteries included" - everyone uses the same one (so things like vulnerability issues are easy to fix) Cons: - someone always wants a special version - hard to do tiered rollouts so changes tend to be big bang - "But what about if we want to build a small docker version?" OPTION 2 "Everyone gets their own conda/venv!" Pros: - Everyone gets exactly what they want - Don't use packages they don't need - Easy to upgrade in phases/tiers etc Cons: - "Wait, we have HOW MANY different conda environments??" - Libraries from different groups may not be tested with the same Python libraries - Vulnerability management is a nightmare b/c you don't even know were all of the different conda envs are. The above is why I'm always skeptical of "This new way will fix it all!". In short, "there are no solutions, only tradeoffs" gets more and more true the later I go in my career.
- anacrolix 1y agothis is from the company that didn't have support for Docker images until 2023? come on...