3 ms·
At the moment the happy path for Nix is using it in the same space that Docker is used now - for providing reproducible dev/prod environments for server backend
by otabdeveloper4 6y ago
At the moment the happy path for Nix is using it in the same space that Docker is used now - for providing reproducible dev/prod environments for server backends. (And in fact Docker and Nix complement and play nice with each other.)
You could theoretically use Nix for managing user apps too, but that's a niche use case and (as you found out) not in a working state.
- jpe90 6y agoSo for the happy path, are you declaring the entire development toolchain on a project by project basis? Any chance you have some recommended resources that show the way you're using it? I was hoping to use it for Haskell but I'd love to see a guide targeted to new users that shows what you're describing.
- otabdeveloper4 6y agoYeah, each project has its own default.nix that might look something like this: { pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/cd63096.tar.gz") { } } : with pkgs; let mypackage = callPackage ./mypackage.nix { stdenv = stdenv; python = python3; }; in dockerTools.buildImage { contents = [ mypackage ]; } You then write a package definition in mypackage.nix, following the template of packaging things in nixpkgs. (Dev environments work in a similar fashion except with mkShell instead of dockerTools.buildImage.) I haven't used Nix flakes but I think it develops this simple idea further.