darling
Declarative And Reproducable LINux Generalized
An extendable and declarative package management system for Linux.
Darling allows existing package managers of almost any form to be managed declaratively, such as
- OS Package managers like
pacman,apt,dnf, etc. - NodeJS global packages
- Visual Studio Code extensions
... and more.
Installation
Manual
Each time you add a new module to darling, The code must be rebuilt from source to include the new Rust library. Thus, the darling source code must always live on your machine. The default location that does not require configuration changes is to place the source at ~/.local/share/daring/soure. You can locate it there as such:
In your .bashrc (or somewhere that you edit your $PATH) add:
Also, ensure you build the project at least once, by cding into the source directory and running cargo build --release. After that, darling will rebuild itself when new modules are added.
Implementing Darling
Darling is designed specifically to be extendible without changing darling itself. This means that new package-related tools can add their own support for darling. darling uses a very specific protocol for creating modules. The process is as follows:
- Create a rust (library) project. It must start with
darling-. For example,cargo new darling-example --lib. Ensure that your name isn't taken oncrates.io. - Add
darling-apito your dependencies withcargo add darling-api. - Create an empty struct that implements
darling::PackageManager.- Ensure that the
get_name()function returns a consistent value on all calls, and that it does not return "module".moduleis a built-in reserved name used by darling to manage itself. Also, it should be unique to other darling modules, or else they will be incompatible. It is convention to make it the name of your crate, without thedarling-prefix. For example, the `darling
- Ensure that the
- Declare a
pub staticvariable of your struct with the namePACKAGE_MANAGERthat is accessible from your crate root. - Publish your crate on
crates.iowithcargo publishj