This wiki page: Flakes - NixOS Wiki
This section:
This is the flake I made that eventually works with nix develop
:
{
description = "Python dev shell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
#stable.url = "github:NixOS/nixpkgs/nixos-23.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {self, nixpkgs, flake-utils}:
flake-utils.lib.eachDefaultSystem(system:
let pkgs = import nixpkgs { inherit system; };
in {
devShells.default = pkgs.mkShell {
buildInputs = [
(pkgs.python311.withPackages (p: with p; [
python-lsp-server
black
mypy
pylint
]))
];
shellHook = "zsh";
};
}
);
}
You may note that the devShells
line contains devShells.default
rather than devShells.${system}.default
When I had the line with ${system}
in it, I was getting errors:
nix flake check
→ error: flake attribute 'devShells.aarch64-darwin.aarch64-darwin' is not a derivation
nix develop
→ error: flake 'git+file:///███████████' does not provide attribute 'devShells.x86_64-linux.default', 'devShell.x86_64-linux', 'packages.x86_64-linux.default' or 'defaultPackage.x86_64-linux' Did you mean devShells?
Am I wrong, or is the wiki? Where should I have looked first to get a basic working example of a working flake-based dev shell?
Should I just paste my flake into the wiki as an example for others?