A flake.legacyPackage() rule builds a nix package of a given flake.
flake.legacyPackage(
name: str,
default_target_platform: None | str = ...,
target_compatible_with: list[str] = ...,
compatible_with: list[str] = ...,
exec_compatible_with: list[str] = ...,
visibility: list[str] = ...,
within_view: list[str] = ...,
metadata: OpaqueMetadata = ...,
tests: list[str] = ...,
modifiers: OpaqueMetadata = ...,
binaries: list[str] = ...,
binary: None | str = ...,
output: str = ...,
package: None | str = ...,
path: str,
)
flake.legacyPackage(
name = "curl",
path = ":nixpkgs",
output = "bin",
binary = "curl",
)This creates a target called curl from the nix flake in ./nix, building path:nix#legacyPackages.<system>.curl.bin.
name of the target
specifies the default target platform, used when no platforms are specified on the command line
a list of constraints that are required to be satisfied for this target to be compatible with a configuration
a list of constraints that are required to be satisfied for this target to be compatible with a configuration
a list of constraints that are required to be satisfied for this target to be compatible with an execution platform
a list of visibility patterns restricting what targets can depend on this one
a list of visibility patterns restricting what this target can depend on
a key-value map of metadata associated with this target
a list of targets that provide tests for this one
an array of modifiers associated with this target
add auxiliary binaries for this package
These can be accessed as sub-targets with the given name in dependent rules.
specify the default binary of this package
This provides RunInfo for a binary in the bin directory of the package.
specify the output to build instead of the default
(optional, default: "out")
name of the flake output
(optional, default: same as name)
the path to the flake
A flake.package() rule builds a nix package of a given flake.
flake.package(
name: str,
default_target_platform: None | str = ...,
target_compatible_with: list[str] = ...,
compatible_with: list[str] = ...,
exec_compatible_with: list[str] = ...,
visibility: list[str] = ...,
within_view: list[str] = ...,
metadata: OpaqueMetadata = ...,
tests: list[str] = ...,
modifiers: OpaqueMetadata = ...,
binaries: list[str] = ...,
binary: None | str = ...,
output: str = ...,
package: None | str = ...,
path: str,
)
flake.package(
name = "curl",
path = "nix",
output = "bin",
binary = "curl",
)This creates a target called curl from the nix flake in ./nix, building path:nix#packages.<system>.curl.bin.
name of the target
specifies the default target platform, used when no platforms are specified on the command line
a list of constraints that are required to be satisfied for this target to be compatible with a configuration
a list of constraints that are required to be satisfied for this target to be compatible with a configuration
a list of constraints that are required to be satisfied for this target to be compatible with an execution platform
a list of visibility patterns restricting what targets can depend on this one
a list of visibility patterns restricting what this target can depend on
a key-value map of metadata associated with this target
a list of targets that provide tests for this one
an array of modifiers associated with this target
add auxiliary binaries for this package
These can be accessed as sub-targets with the given name in dependent rules.
specify the default binary of this package
This provides RunInfo for a binary in the bin directory of the package.
specify the output to build instead of the default
(optional, default: "out")
name of the flake output
(optional, default: same as name)
the path to the flake
Use these in the toolchains cell of your project to define toolchain targets.
Creates a cxx toolchain that is required by all C/C++ rules.
nix_cxx_toolchain(
name: str,
default_target_platform: None | str = ...,
target_compatible_with: list[str] = ...,
compatible_with: list[str] = ...,
exec_compatible_with: list[str] = ...,
visibility: list[str] = ...,
within_view: list[str] = ...,
metadata: OpaqueMetadata = ...,
tests: list[str] = ...,
modifiers: OpaqueMetadata = ...,
c_flags: list[str] = ...,
cpp_dep_tracking_mode: str = ...,
cxx_flags: list[str] = ...,
link_flags: list[str] = ...,
link_ordering: None | str = ...,
link_style: str = ...,
nix_cc: str,
)
# use the `cxx` flake package output from `./nix` to provide the compiler tools
flake.package(
name = "nix_cc",
binaries = [
"ar",
"cc",
"c++",
"nm",
"objcopy",
"ranlib",
"strip",
],
package = "cxx",
path = "nix",
)
# provide the `cxx` toolchain using the `:nix_cc` target
nix_cxx_toolchain(
name = "cxx",
nix_cc = ":nix_cc",
visibility = ["PUBLIC"],
)Note: The nixpkgs cc infrastructure depends on environment variables to be set during execution. You might
need to wrap the C/C++ compiler tools capturing the environment. Take a look at the example project.
name of the target
specifies the default target platform, used when no platforms are specified on the command line
a list of constraints that are required to be satisfied for this target to be compatible with a configuration
a list of constraints that are required to be satisfied for this target to be compatible with a configuration
a list of constraints that are required to be satisfied for this target to be compatible with an execution platform
a list of visibility patterns restricting what targets can depend on this one
a list of visibility patterns restricting what this target can depend on
a key-value map of metadata associated with this target
a list of targets that provide tests for this one
an array of modifiers associated with this target
Creates a python_bootstrap toolchain.
nix_python_bootstrap_toolchain(
name: str,
default_target_platform: None | str = ...,
target_compatible_with: list[str] = ...,
compatible_with: list[str] = ...,
exec_compatible_with: list[str] = ...,
visibility: list[str] = ...,
within_view: list[str] = ...,
metadata: OpaqueMetadata = ...,
tests: list[str] = ...,
modifiers: OpaqueMetadata = ...,
python: str,
)
# use the `python3` flake package output from `./nix` to provide the Python interpreter
flake.package(
name = "python",
binary = "python3",
package = "python3",
path = "nix",
)
# provide the `python_bootstrap` toolchain using the `:python` target
nix_python_bootstrap_toolchain(
name = "python_bootstrap",
python = ":python",
visibility = ["PUBLIC"],
)name of the target
specifies the default target platform, used when no platforms are specified on the command line
a list of constraints that are required to be satisfied for this target to be compatible with a configuration
a list of constraints that are required to be satisfied for this target to be compatible with a configuration
a list of constraints that are required to be satisfied for this target to be compatible with an execution platform
a list of visibility patterns restricting what targets can depend on this one
a list of visibility patterns restricting what this target can depend on
a key-value map of metadata associated with this target
a list of targets that provide tests for this one
an array of modifiers associated with this target
Creates a rust toolchain that is required by all Rust rules.
nix_rust_toolchain(
name: str,
default_target_platform: None | str = ...,
target_compatible_with: list[str] = ...,
compatible_with: list[str] = ...,
exec_compatible_with: list[str] = ...,
visibility: list[str] = ...,
within_view: list[str] = ...,
metadata: OpaqueMetadata = ...,
tests: list[str] = ...,
modifiers: OpaqueMetadata = ...,
allow_lints: list[str] = ...,
clippy: str,
clippy_toml: None | str = ...,
default_edition: None | str = ...,
deny_lints: list[str] = ...,
doctests: bool = ...,
nightly_features: bool = ...,
report_unused_deps: bool = ...,
rustc: str,
rustc_binary_flags: list[str] = ...,
rustc_flags: list[str] = ...,
rustc_target_triple: str = ...,
rustc_test_flags: list[str] = ...,
rustdoc: str,
rustdoc_flags: list[str] = ...,
warn_lints: list[str] = ...,
)
# use the `rustc` flake package output from `./nix` to provide the Rust compiler and rustdoc
flake.package(
name = "rustc",
binaries = ["rustdoc"],
binary = "rustc",
path = "nix",
)
# use the `clippy` flake package output from `./nix` to provide the clippy tool
flake.package(
name = "clippy",
binary = "clippy-driver",
path = "nix",
)
# provide the `rust` toolchain using the `:rustc` and `:clippy` targets
nix_rust_toolchain(
name = "rust",
clippy = ":clippy",
default_edition = "2021",
rustc = ":rustc",
rustdoc = ":rustc[rustdoc]", # use the rustdoc binary from the `rustc` target
visibility = ["PUBLIC"],
)name of the target
specifies the default target platform, used when no platforms are specified on the command line
a list of constraints that are required to be satisfied for this target to be compatible with a configuration
a list of constraints that are required to be satisfied for this target to be compatible with a configuration
a list of constraints that are required to be satisfied for this target to be compatible with an execution platform
a list of visibility patterns restricting what targets can depend on this one
a list of visibility patterns restricting what this target can depend on
a key-value map of metadata associated with this target
a list of targets that provide tests for this one
an array of modifiers associated with this target
the Rust compiler
the Rust documentation tool