Friday, 4 October 2024

Show HN: Compose2nix – NixOS and Docker Compose made easy https://bit.ly/3Ymcl6h

Show HN: Compose2nix – NixOS and Docker Compose made easy Hi! compose2nix is a CLI tool that automatically converts your Docker Compose project into a NixOS configuration[1]. * Why does this even exist? Well, NixOS is a Linux distro that is configured using Nix (the language). However, Compose adds a configuration layer on top that is opaque to Nix, which means you lose out on some of the "magic" of NixOS. compose2nix solves this by "lifting" Compose functionality into native Nix/NixOS constructs, which results in a more native integration with NixOS. In addition, this tool unlocks two primary use-cases: 1. You can run existing non-trivial applications - e.g., Immich - without worrying if they're natively packaged for NixOS. 2. You can bring your existing Compose stack over to NixOS and run it as-is without having to rewrite it in Nix. The auto-generated config can either act as a starting point, or you can keep your Compose file as the source of truth and re-generate it as you go. * How does it work? compose2nix maps Compose constructs into systemd services that run native Docker/Podman commands. Under the hood, the tool utilizes the same Compose library[2] used by the Docker CLI, so you also get Compose syntax checking "for free". In a way, it's a thin re-implementation of the Docker Compose CLI. One thing to point out is that compose2nix aims to natively support both Podman and Docker as container runtimes. The README has a bit more detail. There's also a (somewhat rambly) video that explains what the project is about and includes a short demo of the tool: https://www.youtube.com/watch?v=hCAFyzJ81Pg Oh, and please feel free to shoot me any questions or feedback (good or bad)! [1]: In case it's your first time hearing about NixOS, here is a good overview: https://bit.ly/4dy483a [2]: https://bit.ly/3zK78LY https://bit.ly/3vjj8l0 October 5, 2024 at 02:10AM

No comments:

Post a Comment