I work at a software company in Switzerland, developing pension fund software. Over the past year, I’ve been creating prototype applications to establish a solid foundation for our new application version. We aim to avoid past issues like developer lock-in, obscure manual dependency setups, and slow local builds.
I’ve been using Nix for two months. Initially, I tried setting up our Flutter dev environment with Nix, which was challenging due to limitations with Xcode and Android emulators. I managed to make it work by fetching dependencies with Nix, except for Xcode (pre-installed) and Flutter (installed via tarball), but it wasn’t quite “the Nix way.”
Current Project and Goals
Now, I want to give Nix another chance with a more typical setup. My current project, Game Theory gRPC Sample Project, involves multiple services written in different languages, all communicating via gRPC. This project aims to:
Utilize Nix for seamless dependency management across various languages.
Achieve automated, reproducible builds using Nix Flakes.
Package services into Docker containers managed by Nix for easy deployment.
I’ve managed to build individual services with nix build, but I’m struggling with proper dependency management and often have to disable sandboxing to allow package downloads during builds.
My Questions
How can I find documentation on using different languages’ package management through Nix?
Are there any guides that aren’t centered around NixOS? Most resources seem to assume NixOS usage, but I need to support multiple environments like Ubuntu, Fedora, Mac, and WSL.
Could someone with deeper knowledge of Nix Flakes review my demo project and help me implement best practices?
Goals
My ultimate goal is to:
Call nix build on the main metarepo and output all services wrapped in a Docker container, with dependencies managed by Nix.
Run this build process on GitHub and output Docker images to the GitHub release section.
I’ve mostly learned through YouTube videos, GPT-4 chats, GitHub issues, and Nix Discourse Posts, but I often encounter incorrect or outdated information. I would greatly appreciate it if someone could check out my repo and provide advice on how to improve my flakes setup according to best practices.
I’m not saying it couldn’t happen that you find some free support. But if you are looking for free support, I think your efforts might be more successful if, instead of presenting a “big ask” such as this could be perceived as, ask individual questions, each in their own thread. Just my two cents.
The nixpkgs reference manual (for nixpkgs tooling), wiki.nixos.org and third party blogs posts, primarily. For third party tooling, see their documentation. Sorry I don’t have a better answer.
Could you please provide a guide that you think requires NixOS?
The support does not need to be free. If somebody is willing to help and has a guide on how to do advanced stuff in Nix—beyond the basics like making a flake with one or two dependencies—that would be fantastic. I’m looking for information on best practices for making flakes dependent on each other and managing NuGet packages, Composer dependencies with Nix. Should I just use --option sandbox false and use the native package managers?
Every error I search for, and most of the posts in the Nix discourse, are centered around installation and other issues with NixOS. I need guidance on more than just “this is a flake, it has inputs and can output packages and devshells, and it can output NixOS configurations. (wow)” … I can hack my way to a working solution … but that’s not the goal.
I know I sound a bit frustrated, but any detailed help would be greatly appreciated.
I would avoid disabling the sandbox. Nix is quite capable. One of the best ways to learn Nix is to studying examples. Nixpkgs is one gigantic example. There could be some examples on GitHub; that has a useful search feature.
If you’re willing to look for some paid support, feel free to post in the #jobs category.
And if you post some more specific question(s), I’d be happy to take a look and see if I can help you get along. But probably best in their own neat little threads.
I think my first step will be to step away from using Flakes, as was pointed out in a reply. Maybe I can try to understand Nixpkgs better. When I get stuck, I will look for help under the #jobs section.