Start with a small toolchain.
Save this as flake.nix in a project directory. The example targets x86_64 Linux; use aarch64-linux for an ARM Linux machine. The output’s system key selects the platform, not an operating-system installation.
mkShell describes a development environment. It does not create a container or automatically pin Python packages from pip. Those dependencies need their own project strategy.
{
description = "A shared development shell";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { nixpkgs, ... }: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.${system}.default = pkgs.mkShell {
packages = [ pkgs.git pkgs.python3 ];
shellHook = ''
echo "Development tools are ready."
'';
};
};
}
One command at the project root.
Add the file to Git, enter the shell, and check your tools. The first run may need downloads. Commit the generated lock file so your teammates use the same inputs.
exit leaves the shell. A shellHook runs when entering the development shell, so read a project’s Nix code before using it, just as you would inspect any setup script.
git add flake.nix
nix develop
python --version
git --version
exit
git add flake.lock
A devShell supplies project tools. Language-level dependencies still need to be declared and pinned.