On a NixOS system, "pkgs.brave" typically refers to the Brave web browser package within the Nix package set (usually from nixpkgs). To find out what it evaluates to, you can use Nix tools to evaluate the expression. Evaluating it will give you the derivation (a build specification) for the package, which includes details like the store path and attributes.
Here are a few ways to do this, depending on your needs:
1. Using the Nix REPL (Interactive and Easy)
The Nix REPL is a great way to interactively evaluate Nix expressions. Run the following command in your terminal:
nix repl '<nixpkgs>'
This method uses the nixpkgs channel configured in your NIX_PATH. If you want to use a specific nixpkgs (e.g., the one from your system configuration), you can specify it, like nix repl '/run/current-system/nixpkgs'.
2. Using nix eval (Command-Line Evaluation)
For a non-interactive approach, use the nix eval command to evaluate the expression directly. This is available in Nix 2.0 and later.
-
Basic evaluation:
nix eval nixpkgs#brave
- Output: This will print the derivation path, e.g.,
/nix/store/somehash-brave-version.drv. This is what "pkgs.brave" evaluates to in terms of the derivation.
-
To get a more readable JSON output (showing attributes like name, version, etc.):
nix eval --json nixpkgs#brave
-
If you want the output path of the built package (not just the derivation), use:
nix eval --raw nixpkgs#brave.outPath
- Note: This still doesn't build the package; it just evaluates the path. To actually build and get the output, use
nix build.
3. Considering Your NixOS System Configuration
- By default,
nixpkgs#brave uses the nixpkgs from your NIX_PATH (often set by channels like nix-channel --add https://nixos.org/channels/nixpkgs-unstable). This might not exactly match the pkgs in your system's /etc/nixos/configuration.nix if you've pinned a specific nixpkgs version.
- To evaluate
pkgs.brave based on your system's configuration:
Additional Notes
- What does "evaluates to" mean? In Nix, evaluating an attribute like
pkgs.brave gives you a derivation, which is a blueprint for building the package. It doesn't actually build the package unless you explicitly run a build command (e.g., nix build nixpkgs#brave).
- Version Differences: The exact derivation depends on the nixpkgs version you're using. You can check your current nixpkgs channel with
nix-channel --list or see the version in the REPL by evaluating lib.version.
- If Brave Isn't Found: If
brave isn't available (e.g., in an older nixpkgs), you might get an error. Ensure Brave is included in your nixpkgs by checking the package search or updating your channels.
If you need more details, such as building the package or inspecting its dependencies, let me know!