Forrest logo
tool overview
On this page you find all important commands for the CLI tool nix. If the command you are looking for is missing please ask our AI.

nix

Nix is a command-line package manager and a pure functional package management system. It was created to manage software dependencies in a declarative and reproducible manner. With Nix, you can build and manage packages across multiple Linux distributions and even macOS.

Nix utilizes a unique approach known as the Nix expression language to describe package dependencies and build instructions. This allows for expressing complex build setups and resolving dependencies in a deterministic and hermetic manner.

One of the key features of Nix is its support for creating isolated and sandboxed environments, known as Nix environments. These environments ensure that packages have all their required dependencies and do not interfere or clash with each other. This makes it easy to create reproducible and isolated software development environments.

Nix also provides powerful tools for package management, such as rollbacks, binary caching, and atomic upgrades. These features enable easy system upgrades and provide a consistent and reliable way to manage and rollback changes.

Nix has a large and active community of users who provide support, contribute to package libraries, and share their experiences. It is an open-source project that is actively maintained and developed, ensuring a continually improving ecosystem.

Nix integrates well with other package management systems, making it possible to use Nix packages alongside existing system packages. It also supports cross-compilation, allowing developers to build packages for different architectures and platforms.

Nix has a rich ecosystem of packages available in the Nix package collection, known as Nixpkgs. This collection includes thousands of pre-built software packages that can be easily installed and managed using Nix.

The Nix expression language allows for easy reproducibility and sharing of package definitions, making it straightforward to collaborate on software development projects. Nix expressions can be version-controlled and distributed across systems for consistent builds.

Overall, Nix is a powerful and flexible command-line tool that provides a unique approach to package management. Its declarative and functional nature, combined with strong isolation and reproducibility features, make it an excellent choice for managing software dependencies and building reliable software systems.

List of commands for nix:

  • nix3-build:tldr:1906f nix3-build: Build a package from nixpkgs, symlinking the result to `./result`.
    $ nix build ${nixpkgs#pkg}
    try on your machine
    explain this command
  • nix3-build:tldr:75b84 nix3-build: Build a package without making the `result` symlink, instead printing the store path to the stdout.
    $ nix build --no-link --print-out-paths
    try on your machine
    explain this command
  • nix3-build:tldr:cd83c nix3-build: Build a package from a flake in the current directory, showing the build logs in the process.
    $ nix build -L ${-#pkg}
    try on your machine
    explain this command
  • nix3-develop:tldr:1013a nix3-develop: Start a shell with all dependencies of a package from nixpkgs available.
    $ nix develop ${nixpkgs#pkg}
    try on your machine
    explain this command
  • nix3-develop:tldr:32180 nix3-develop: Start a development shell for the default package in a flake in the current directory.
    $ nix develop
    try on your machine
    explain this command
  • nix3-edit:tldr:a52df nix3-edit: Open the source of the Nix expression of a package from nixpkgs in your `$EDITOR`.
    $ nix edit ${nixpkgs#pkg}
    try on your machine
    explain this command
  • nix3-flake:tldr:2e28e nix3-flake: Show all the outputs of a flake on github.
    $ nix flake show ${github:owner-repo}
    try on your machine
    explain this command
  • nix3-flake:tldr:6216e nix3-flake: See documentation about what Nix flakes are.
    $ nix flake --help
    try on your machine
    explain this command
  • nix3-flake:tldr:acca6 nix3-flake: Update all inputs (dependencies) of the flake in the current directory.
    $ nix flake update
    try on your machine
    explain this command
  • nix3-flake:tldr:b5eba nix3-flake: Create a new flake (just the `flake.nix` file) from the default template, in the current directory.
    $ nix flake init
    try on your machine
    explain this command
  • nix3-flake:tldr:c5d88 nix3-flake: Update a specific input (dependency) of the flake in the current directory.
    $ nix flake lock --update-input ${input}
    try on your machine
    explain this command
  • nix3-profile:tldr:411e2 nix3-profile: Remove a package installed from nixpkgs from the default profile, by name.
    $ nix profile remove ${legacyPackages-x86_64-linux-pkg}
    try on your machine
    explain this command
  • nix3-profile:tldr:4e850 nix3-profile: Rollback (cancel) the latest action on the default profile.
    $ nix profile rollback
    try on your machine
    explain this command
  • nix3-profile:tldr:83d0b nix3-profile: Upgrade packages in the default to the latest available versions.
    $ nix profile upgrade
    try on your machine
    explain this command
  • nix3-profile:tldr:bb50c nix3-profile: List packages currently installed in the default profile.
    $ nix profile list
    try on your machine
    explain this command
  • nix3-profile:tldr:e3771 nix3-profile: Install a package from a flake on GitHub into a custom profile.
    $ nix profile install ${github:owner-repo-pkg} --profile ${--path-to-directory}
    try on your machine
    explain this command
  • nix3-registry:tldr:20408 nix3-registry: Pin the `nixpkgs` revision to the current version of the upstream repository.
    $ nix registry pin ${nixpkgs}
    try on your machine
    explain this command
  • nix3-registry:tldr:2e32a nix3-registry: Pin an entry to the latest version of the branch, or a particular reivision of a github repository.
    $ nix registry pin ${entry} ${github:owner-repo-branch_or_revision}
    try on your machine
    explain this command
  • nix3-registry:tldr:7fb87 nix3-registry: Remove a registry entry.
    $ nix registry remove ${entry}
    try on your machine
    explain this command
  • nix3-registry:tldr:8a517 nix3-registry: See documentation about what Nix flake registries are.
    $ nix registry --help
    try on your machine
    explain this command
  • nix3-registry:tldr:f482e nix3-registry: Add a new entry that always points to the latest version of a github repository, updating automatically.
    $ nix registry add ${entry} ${github:owner-repo}
    try on your machine
    explain this command
  • nix3-run:tldr:06db1 nix3-run: Run a command whose name matches the package name from nixpkgs (if you want a different command from that package, see `tldr nix3 shell`).
    $ nix run nixpkgs#${pkg}
    try on your machine
    explain this command
  • nix3-run:tldr:b82ee nix3-run: Run the default application in the flake in the current directory.
    $ nix run
    try on your machine
    explain this command
  • nix3-search:tldr:0a4eb nix3-search: Search `nixpkgs` for a package based on its name or description.
    $ nix search ${nixpkgs} ${search_term---}
    try on your machine
    explain this command
  • nix3-search:tldr:cf189 nix3-search: Show description of a package from nixpkgs.
    $ nix search ${nixpkgs#pkg}
    try on your machine
    explain this command
  • nix3-shell:tldr:2a162 nix3-shell: Start a shell with the "default package" from a flake in the current directory, printing build logs if any builds happen.
    $ nix shell -L
    try on your machine
    explain this command
  • nix3-shell:tldr:3c6d5 nix3-shell: Run a command in a shell with a package.
    $ nix shell ${nixpkgs#pkg} -c ${some-cmd --someflag 'Some other arguments'}
    try on your machine
    explain this command
  • nix3-store:tldr:03004 nix3-store: Show the differences in versions between two store paths, with their respective dependencies.
    $ nix store diff-closures ${-nix-store----} ${-nix-store----}
    try on your machine
    explain this command
  • nix3-store:tldr:03ae2 nix3-store: List a contents of the store path, on a remote store.
    $ nix store --store ${https:--cache-nixos-org} ls ${-nix-store----}
    try on your machine
    explain this command
  • nix3-store:tldr:478a3 nix3-store: Hard-link identical files together to reduce space usage.
    $ nix store optimise
    try on your machine
    explain this command
  • nix3-store:tldr:9b42f nix3-store: Delete a specific store path (most be unused).
    $ nix store delete ${-nix-store----}
    try on your machine
    explain this command
  • nix3-why-depends:tldr:169cb nix3-why-depends: Show why the currently running NixOS system requires a certain store path.
    $ nix why-depends ${-run-current-system} ${-nix-store----}
    try on your machine
    explain this command
  • nix3-why-depends:tldr:cda86 nix3-why-depends: Show why a package from nixpkgs requires another package as a _build-time_ dependency.
    $ nix why-depends --derivation ${nixpkgs#dependent} ${nixpkgs#dependency}
    try on your machine
    explain this command
  • nix:tldr:1e3ff nix: Start a shell with the specified packages from nixpkgs available.
    $ nix shell ${nixpkgs#pkg1 nixpkgs#pkg2 nixpkgs#pkg3 ---}
    try on your machine
    explain this command
  • nix:tldr:7733b nix: Display help for the `nix` subcommand.
    $ nix help ${subcommand}
    try on your machine
    explain this command
  • nix:tldr:90303 nix: Remove unused paths from Nix store to free up space.
    $ nix store gc
    try on your machine
    explain this command
  • nix:tldr:a9cc5 nix: Start an interactive environment for evaluating Nix expressions.
    $ nix repl
    try on your machine
    explain this command
  • nix:tldr:b7ccb nix: Search for a package in nixpkgs via its name or description.
    $ nix search nixpkgs ${search_term}
    try on your machine
    explain this command
  • nix:tldr:e80b3 nix: Install some packages from nixpkgs permanently.
    $ nix profile install ${nixpkgs#pkg1 nixpkgs#pkg2 nixpkgs#pkg3 ---}
    try on your machine
    explain this command
tool overview