Skip to content

Dependencies

GitHub Action edited this page Mar 5, 2024 · 2 revisions

Another way, in which pusta is very similar to a normal package manager, is its dependency system. It has a fully featured dependency system built in. This enables you to structure your configuration modular, but still ensure that the dependencies for a module are available. Note, that using the dependency system is of course optional, you won't even notice it if you don't use it in your configs.

With it, each module can have a list of dependencies, that get installed alongside that module when it is. This is very useful when you have a module that requires something else to run or install, that however is also used by many other modules and does really belong to that module. For example if many of your modules depend on a particular scripting language, they all may have a module as a dependency that installs and configures that scripting language.

Pusta's dependencies are constructive, meaning that it is made sure that dependencies for a given module are installed, but not automatically removed. In the most cases this is beneficial so that modules initially installed as dependencies don't get removed without any intent of the user.

Resolving

As with any dependency system, there are a few properties, which enable you to generalize your dependency relationships. Because of that, the dependency resolving is not solely based on Qualifiers, but also on a special property provides. This property serves as an alternative alias for each module, special being that you can have many modules which have the same provides in one repository.

That means, that there are three options for how a module may qualify as a dependency for a given string:

  • provides - The module provides this string in its provides property.
  • alias - The module's alias or normal qualifier matches the string.
  • unique qualifier - The module's unique qualifier matches the string.

If multiple modules qualify for a dependency, Pusta will prompt the user to choose which dependency to install.

Properties

To configure your module with dependencies, or for it to be able to be leveraged as a dependency by other modules, you can use the following properties in your module.yml files:

# module.yml 

depends: [module1 module2 ...] # optional - list of strings which are the module's dependencies

provides: [string] # optional - string which this module provides
  • depends (optional) - Specifies the dependencies of the module. It is a list of strings for which other may qualify as dependencies. Which modules are meant by one of these strings can be seen in the Resolving chapter.
  • provides (optional) - Specifies an additional alias for the module. This string is only used for dependency qualifying, and contrary to the normal alias is not exclusive to only one module per repository. Again, see the Resolving chapter to see how this impacts resolving.

Example

The following example shows a scenario, where one module depends on the other. The aliases serve as extra context. The following module is the dependency:

# module.yml

alias: rustup
provides: rust

This module depends on the just specified dependency over that dependencies provider. It itself depends on two modules:

# module.yml

alias: custom-greeter # compiled from source and written in rust
depends: rust greetd

Home
Getting Started

Structure your Config:
Repositories
Modules
Jobs
    File Job
    Package Job
    Command Job
    Script Job
Dependencies
Variables
    Modifiers
    Control Flow

Working with Pusta:
Workflow
Other Commands

Customizing Pusta:
Configuration

Clone this wiki locally