NAME
flox-build-import-nixpkgs - Import package definition from nixpkgsSYNOPSIS
DESCRIPTION
Import a package definition from nixpkgs for use in the environment. This command copies the source code of a package from nixpkgs into the environment’s.flox/pkgs/ directory, allowing you to modify and build
the package locally.
The package definition is imported as a Nix expression file at
.flox/pkgs/<package>/default.nix, where <package> is the attribute
path of the package (e.g., hello for nixpkgs#hello).
This is useful when you need to:
- Modify a package’s build process
- Apply patches or customizations
- Debug package issues
- Create variants of existing packages
Installable format
The<installable> parameter can be specified in one of the following
formats:
- Attribute path only:
hello(defaults tonixpkgs#hello) - Flake reference with attribute:
nixpkgs#hello - Full flake reference:
github:nixos/nixpkgs#hello
--stability, the installable must be a bare attribute path
or the nixpkgs# prefix form. An explicit flake reference
(e.g. github:nixos/nixpkgs#hello) cannot be combined with the flag.
OPTIONS
<installable>The package to import from nixpkgs. Can be specified as an attribute path (e.g.,
hello) or as a flake reference with attribute path (e.g.,
nixpkgs#hello).
--forceOverwrite existing package file if it already exists. Without this flag, the command will fail if the package file already exists in the environment.
--stability <stability>Import using a base package set of the given stability as tracked by the catalog server. A stability (e.g.,
"stable" or "unstable")
identifies a curated nixpkgs revision managed by the catalog server.
When omitted, the default nixpkgs channel is used. Cannot be combined
with an explicit flake reference in <installable>.
Environment Options
If no environment is specified for an environment command, the environment in the current directory or the active environment that was last activated is used.-d, --dirPath containing a .flox/ directory.
General Options
-h, --helpPrints help information. The following options can be passed when running any
flox subcommand
but must be specified before the subcommand.
-v, --verboseIncrease logging verbosity. Invoke multiple times for increasing detail.
-q, --quietSilence logs except for errors.
EXAMPLES
Import a simple package
Import thehello package from nixpkgs:
.flox/pkgs/hello/default.nix with the package definition.
Import using a specific stability
Importsamba from the unstable channel as tracked by the catalog:
Import from a specific nixpkgs revision
Import a package from a specific nixpkgs revision:Overwrite an existing package
Force import a package, overwriting any existing definition:Import a complex package
Import a package with a nested attribute path:.flox/pkgs/python310Packages/requests/default.nix.
NOTES
- This command only works with local environments (not managed or remote environments)
- The imported package definition is a snapshot of the source code at the time of import
- You can modify the imported package definition and build it using
flox build - The package will be available in the environment’s build context
SEE ALSO
flox-build,
flox-build-clean,
manifest.toml