nix Verified current stable Not installed? Package Management

Nix / Install Package Flake Github Custom Profile

Install Package Flake Github Custom Profile

Installs a package from a GitHub flake into a specified profile.

$
Terminal
nix profile add {github:owner/repo/pkg} --profile <path/to/directory>

When To Use

When integrating third-party packages from GitHub into custom user profiles.

Pro Tip

Use the --rev flag to specify a particular commit, tag, or branch for repeatability in production environments.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
nix profile add {github:owner/repo/pkg} --profile <path/to/directory>

Anatomy of Output

Understanding the result

Installing: somepackage-1.0.0 Installation Summary

Indicates which package is being installed from the GitHub flake.

Profile updated: ~/.nix-profile Profile Update Confirmation

The user profile has been updated with new package.

Duration: 0.156s Performance Metrics

Time taken for the installation process.

Power User Variants

Optimized versions

nix profile add github:user/repo/pkg --profile ~/.nix-profile --rev v1.0.0

Install a specific version of the package.

nix profile add github:user/repo/pkg --profile ~/.nix-profile --disable-conflict-checks

Ignore conflicts when installing the package.

Troubleshooting

Common pitfalls

error: repository not found on GitHub

Solution: Confirm that the repository URL and access permissions are correct.

error: package not found in specified repo

Solution: Check for the package name in the specified GitHub flake.

error: insufficient permissions for path

Solution: Use elevated permissions if installing to restricted directory.

Command Breakdown

What each part is doing

nix
Base Command
The executable that performs this operation. Here it runs Nix before the shell applies any redirect operators.
{github:owner/repo/pkg}
github:owner repo pkg
The value supplied for github:owner repo pkg.
<path/to/directory>
path to directory
The directory path supplied to this command.
--profile
Command Option
Tool-specific option used by this command invocation.

Alternative Approaches

Comparable commands in other tools

Alternative package management tools for the same job.