Hello!
While learning NixOS, I found that there is a common convention where the programmer will declare an attribute set, function, or overlay in the outputs
of a flake.nix to be named rec
. For example,
{
description = "A flake example to point out common usage of rec function name"
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
utils.url = "github:numtide/flake-utils?rev=c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a "
};
outputs = { self, nixpkgs, utils, ... }: let
name = "flake-example"
in utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs { inherit system; };
in rec { # <-- see right here!
devShells.default = pkgs.mkShell {
packages = [];
};
}
);
}
^flake.nix
What is the purpose of naming the output function rec
? The program compiles and works just the same with rec
removed.