Skip to content

PrestonHager/PMSM

Repository files navigation

PMSM

Package Management System Manager - Generate, build, and publish packages for multiple package managers from a single YAML configuration.

Documentation: pmsm.readthedocs.io (built with MkDocs; sources under docs/).

Features

  • Single Configuration File - Define all package managers in one pmsm.yaml file
  • Multiple Package Managers - Support for APT/DEB, APK (Alpine), AUR (Arch), and Nix
  • Generate, Build, and Publish - Complete workflow from definition to publication
  • Per-Package Manager Customization - Override fields and scripts for each package manager
  • Interactive Account Setup - Guided setup for package manager publishing credentials
  • GitHub Actions Ready - Automated package generation and publishing on releases

Installation

Using Nix (Recommended)

# Enter development shell
nix develop

# Build the project
nix build

# Run the binary
./result/bin/pmsm --help

Using Cargo

cargo build --release
./target/release/pmsm --help

Quick Start

  1. Initialize a configuration file:

    pmsm init
  2. Edit pmsm.yaml with your package details:

    package:
      name: myapp
      version: "1.0.0"
      description: "My application"
      homepage: "https://github.com/user/myapp"
      license: "GPL-3.0"
      maintainer:
        name: "Your Name"
        email: "your@email.com"
    
    build:
      source: "https://github.com/user/myapp/releases/download/v{version}/myapp-{version}.tar.gz"
      build: "make"
      install: "make install DESTDIR=\"$pkgdir\""
    
    package_managers:
      apt:
        enabled: true
      aur:
        enabled: true
  3. Validate your configuration:

    pmsm validate
  4. Generate package definition files:

    pmsm generate
  5. Build packages:

    pmsm build
  6. Setup publishing credentials:

    pmsm setup --manager apt
    pmsm setup --manager aur
  7. Publish packages:

    pmsm publish

Configuration

The pmsm.yaml file supports the following structure:

Package Information

package:
  name: myapp              # Package name
  version: "1.0.0"         # Package version
  description: "..."       # Package description
  homepage: "https://..."  # Homepage URL
  license: "GPL-3.0"       # License identifier
  maintainer:
    name: "Name"
    email: "email@example.com"

Build Configuration

build:
  source: "https://..."     # Source URL (supports {version}, {name} templates)
  build: "make"             # Build command (optional)
  prepare: "./configure"    # Prepare command (optional)
  install: "make install"   # Install command (optional)

Dependencies

dependencies:
  runtime:                  # Runtime dependencies
    - libc6
    - openssl
  build:                    # Build-time dependencies
    - gcc
    - make

Package Manager Configuration

Each package manager can be customized:

package_managers:
  apt:
    enabled: true
    section: "utils"        # Debian section
    priority: "optional"    # Debian priority
    depends:                # Override dependencies
      - libssl-dev
    build: "make"           # Override build script
    install: "make install"  # Override install script
  
  apk:
    enabled: true
    depends:
      - openssl-dev
  
  aur:
    enabled: true
    pkgrel: 1               # Package release number
    arch: ["x86_64"]        # Supported architectures
  
  nix:
    enabled: true
    flake: false            # true: generate flake.nix + nix/overlay.nix; build with `nix build`
    # flake_package: "my-app"  # optional pkgs.<name> (default: package.name)
    # nixpkgs_input: "github:NixOS/nixpkgs/nixos-unstable"
    buildInputs:            # Nix build inputs
      - openssl

Commands

pmsm init

Create an example pmsm.yaml configuration file.

pmsm init [--output pmsm.yaml]

pmsm validate

Validate the configuration file.

pmsm validate [--config pmsm.yaml]

pmsm generate

Generate package definition files for enabled package managers.

pmsm generate [--config pmsm.yaml] [--manager apt]

pmsm build

Build packages for enabled package managers.

pmsm build [--config pmsm.yaml] [--manager apt]

pmsm publish

Publish packages to package manager repositories.

pmsm publish [--config pmsm.yaml] [--manager apt]

pmsm setup

Interactive setup wizard for package manager publishing credentials.

pmsm setup [--manager apt]

GitHub Actions Integration

For a full walkthrough (secrets, triggers, and alignment with .github/workflows/pmsm-action.yml), see docs/github-actions.md or the hosted GitHub Actions page.

Add the workflow to your repository at .github/workflows/pmsm.yml:

name: PMSM Package Generation and Publishing

on:
  release:
    types: [published]
  workflow_dispatch:

jobs:
  generate-and-publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - run: cargo build --release
      - run: ./target/release/pmsm generate
      - run: ./target/release/pmsm build
      - run: ./target/release/pmsm publish
        env:
          LAUNCHPAD_USERNAME: ${{ secrets.LAUNCHPAD_USERNAME }}
          AUR_USERNAME: ${{ secrets.AUR_USERNAME }}
          CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}

Supported Package Managers

APT/DEB (Debian/Ubuntu)

  • Generates: debian/control, debian/changelog, debian/rules
  • Builds: .deb packages using dpkg-buildpackage
  • Publishes: Launchpad PPA using dput

APK (Alpine Linux)

  • Generates: APKBUILD
  • Builds: .apk packages using abuild
  • Publishes: Alpine repository (manual upload required)

AUR (Arch User Repository)

  • Generates: PKGBUILD
  • Builds: .pkg.tar.xz packages using makepkg
  • Publishes: AUR via SSH using git

Nix

  • Generates: default.nix derivation; with nix.flake: true, also flake.nix and nix/overlay.nix
  • Builds: nix-build default.nix by default, or nix build when flakes are enabled
  • Publishes: Cachix or Nixpkgs (manual PR)

With flake: true, run nix flake lock once in your repo so flake.lock pins nixpkgs. End users can add your overlay and install the package, for example:

{ pkgs, ... }: let
  version = "1.0.0";
  mySrc = pkgs.fetchFromGitHub {
    owner = "you";
    repo = "yourrepo";
    rev = "v${version}";
    sha256 = "<hash from nix-prefetch-github or similar>";
  };
in {
  nixpkgs.overlays = [
    (import "${mySrc}/nix/overlay.nix")
  ];
  environment.systemPackages = [ pkgs."your-flake-package" ];
}

Use the same string for pkgs."..." as flake_package in pmsm.yaml (defaults to package.name). Hyphenated names must be quoted as shown.

Template Variables

The following variables can be used in configuration strings:

  • {name} - Package name
  • {version} - Package version
  • {description} - Package description
  • {homepage} - Homepage URL
  • {license} - License identifier
  • {maintainer_name} - Maintainer name
  • {maintainer_email} - Maintainer email

Example:

build:
  source: "https://github.com/user/{name}/releases/download/v{version}/{name}-{version}.tar.gz"

Development

Using Nix Flake

# Enter development shell
nix develop

# Build the project
nix build

# Run tests
cargo test

Using Cargo

# Build
cargo build

# Run
cargo run -- --help

# Test
cargo test

# Format
cargo fmt

# Lint
cargo clippy

License

GPL-3.0

About

Package Management System Manager

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors