Dependencies¶
Important
This section focuses on adding dependencies to EPICS top packages. Adding dependencies to other types of Nix packages is different because of how EPICS handles cross-compilation.
For a general explanation, read Nix dependency types.
Adding dependencies¶
Tip
When changing the dependencies of your IOC,
remember to exit and re-enter your development shell
and run epicsConfigurePhase.
Adding EPICS support modules¶
To add an EPICS support module as a dependency,
add it to propagatedBuildInputs:
ioc.nix — Adding an EPICS support module as a dependency¶{
mkEpicsPackage,
lib,
epnix,
}:
mkEpicsPackage {
# ...
propagatedBuildInputs = [ epnix.support.StreamDevice ];
# ...
}
Adding libraries¶
If your IOC depends on a system library,
add it to both nativeBuildInputs and buildInputs:
ioc.nix — Adding a system library as a dependency¶{
mkEpicsPackage,
lib,
epnix,
libpcre,
}:
mkEpicsPackage {
# ...
nativeBuildInputs = [ libpcre ];
buildInputs = [ libpcre ];
# ...
}
Adding build tools¶
If your IOC needs to run a tool during compilation,
add it to nativeBuildInputs:
ioc.nix — Adding a build tool as a dependency¶{
mkEpicsPackage,
lib,
epnix,
python3,
}:
mkEpicsPackage {
# ...
# If you need to run a Python script during the build
nativeBuildInputs = [ python3 ];
# ...
}
Special cases¶
If the build tool you want to add generates native code
or searches for system libraries (such as pkg-config),
add it to both depsBuildBuild and nativeBuildInputs:
ioc.nix — Adding a special build tool as a dependency¶{
mkEpicsPackage,
lib,
epnix,
pkg-config,
}:
mkEpicsPackage {
# ...
# pkg-config searches for system libraries
depsBuildBuild = [ pkg-config ];
nativeBuildInputs = [ pkg-config ];
# ...
}
Listing dependencies¶
To list all the dependencies of your EPICS top package, build your top package and run:
nix path-info -rsSh ./result
This command shows all the dependencies of your package recursively.
For more information,
see the nix path-info manual.
Finding a dependency chain¶
To find why your package depends on a specific dependency, copy the dependency path shown in the Listing all dependencies of a Nix package output and run:
nix why-depends ./result /nix/store/...-my-dependency
For more information,
see the nix why-depends manual.