What is this "import" statement that has a slash inside?

I have this expression:
import <nixpkgs/nixos> { configuration = ...;}
I want to pin the version of nixpkgs and get rid of channels, but can’t find the doc for this import syntax.
Edited: the slash is literal and does NOT imply an “or” as a shorthand for OR . I understand that it means the module nixos (or more precisely the file nixos/default.nix ) - instead of the top-level - under channel .

This might help: FAQ/Pinning Nixpkgs - NixOS Wiki


sorry I did emphasize enough. What I can’t find the doc for is (non-top-level?) <nixpkgs/nixos> which basically <some-channel/some-sub-module>. I didn’t mean an “or” (ie <nixpkgs> OR <nixos>). I can’t find an explanation in the above link.

I’ve changed the post title to reflect this better.

Okay I’ve figured it out:

let pkgs-tbz = builtins.fetchTarball {...};
import (pkgs-tbz + "/nixos") { configuration = ...;}

It roughly means download the code at the nixpkgs entry of the NIX_PATH environment variable, and extract it, then import the file at ./nixos/default.nix inside of that source tree. In other words, import this file: nixpkgs/default.nix at 53bc699e2c9bf49d747089f9a56260ab1c163d52 · NixOS/nixpkgs · GitHub

1 Like