What is in the NixOS/nix repo exactly?

If I understand it correctly, NixOS/nix is home for the following:

  • the implementation of the Nix expression language
  • the nix-* commands
  • the experimental nix * commands (documented only in nix --help?)

but not the nixos-* command line commands (are these in the NixOS/nixpkgs repo?).

Also, is there a document somewhere on how the NixOS/nix repo is organized? Some guesses:

├── config            -> looong shell scripts - for what purpose?
├── contrib           -> debug?
├── doc               -> Nix manual (https://nixos.org/manual/nix/stable/)
├── m4                -> Autotools-related
├── maintainers       -> Collect maintainer info from pkgs?
├── misc              -> various shell and system specific scripts
                         (e.g., systemd, zsh, etc.)
├── mk                -> Autotools?
├── nix-rust          -> only vastly vague assumptions on this one...
├── perl              -> A perl helper library for Nix-stuff?
├── scripts           -> Install scripts?
├── src               -> Sources for Nix lang, nix-?.* CLI commands
├── tests             -> tests:)
├── bootstrap.sh
├── configure.ac
├── default.nix
├── flake.lock
├── flake.nix
├── local.mk
├── Makefile
├── Makefile.config.in
├── precompiled-headers.h
├── README.md
└── shell.nix

1 Like

Right – it is an upstream repository for the Nix package.

Correct – Nix is separate thing from Nixpkgs and NixOS, which only build on Nix. The latter two are conceptually separate too, though many NixOS modules do depend on packages from Nixpkgs, and NixOS shares the repository with NIxpkgs.

nixos-rebuild is defined in pkgs/os-specific/linux/nixos-rebuild/ and the rest of the tools in nixos/modules/installer/tools/.

Not that I am aware of but it is pretty standard layout for a C(++)-based free-software project. Not that there is a standard. But if you look loosely enough…

More Autotools stuff – Nix does not use automake so these need to be vendored (relevant commit).

Since Nix has (at least in theory) little to do with Nixpkgs that is not it. Those are just tools to simplify upstream maintenance – uploading package tarball and other files for Nix release, from the looks of it.