Multi platform configLearn how to set up for different platforms/OS's
Danger
This is the old documentation website please visit the new site
Pixi's vision includes being supported on all major platforms. Sometimes that needs some extra configuration to work well. On this page, you will learn what you can configure to align better with the platform you are making your application for.
Here is an example pixi.toml
that highlights some of the features:
Platform definition
The project.platforms
defines which platforms your project supports.
When multiple platforms are defined, pixi determines which dependencies to install for each platform individually.
All of this is stored in a lockfile.
Running pixi install
on a platform that is not configured will warn the user that it is not setup for that platform:
Target specifier
With the target specifier, you can overwrite the original configuration specifically for a single platform.
If you are targeting a specific platform in your target specifier that was not specified in your project.platforms
then pixi will throw an error.
Dependencies
It might happen that you want to install a certain dependency only on a specific platform, or you might want to use a different version on different platforms.
In the above example, we specify that we depend on msmpi
only on Windows.
We also specifically want python
on 3.8
when installing on Windows.
This will overwrite the dependencies from the generic set of dependencies.
This will not touch any of the other platforms.
You can use pixi's cli to add these dependencies to the pixi.toml
This also works for the host
and build
dependencies.
Which results in this.
Activation
Pixi's vision is to enable completely cross-platform projects, but you often need to run tools that are not built by your projects.
Generated activation scripts are often in this category, default scripts in unix are bash
and for windows they are bat
or ps1
To deal with this, you can define your activation scripts using the target definition.
When this project is run on win-64
it will only execute the target scripts not the scripts specified in the default activation.scripts