.pkg.tar.zst (Pacman)
packages for Arch Linux and its derivatives (Manjaro, EndeavourOS, etc.).
Unlike traditional builders, it directly utilizes Arch Linux's official
makepkg packaging system as a
child process under the hood to completely comply with Arch Linux packaging
standards.
npx
electron-make-pacman..cjs) and ES
Modules (.js - ESM)
standards, ensuring full compatibility with both modern and legacy
Node.js projects..desktop
launcher file, embedding properties like Categories and StartupWMClass, and seamlessly
handles system icon transitions.setUID (4755) permission fixes
for the chrome-sandbox (an
Electron requirement) during the makepkg process.pino and
pino-pretty for debugging and
environment communication.
aurOnly option to bypass
standard packaging. Instead of building from local files, it dynamically
pulls your app from a GitHub Release URL, generating only the .SRCINFO file to prepare an
Arch User Repository (AUR) structure.
repo-add to register your
newly compiled .pkg.tar.zst into a specified
custom Pacman repository database.npm install --save-dev electron-make-pacman
makepkg
utility (Arch base system) must be installed on your host machine.
forge.config.js, forge.config.cjs, or forge.config.ts:
// For CJS projects: const MakerPacman = require('electron-make-pacman').default;
import MakerPacman from 'electron-make-pacman';
export default {
// ... other forge configs
makers: [
new MakerPacman({
options: {
depends: ['gtk3', 'nss', 'libxss', 'libxtst', 'alsa-lib'], // Arch dependencies
icon: '/absolute/path/to/app-icon.png',
desktopCategories: ['Utility', 'Development'],
// aurOnly: true, // Only generates .SRCINFO for the AUR without building the package
// githubReleaseUrl: 'https://github.com/user/repo/releases/download/v1.0.0/app-linux.tar.gz'
// repoDb: '/var/lib/pacman/custom.db.tar.gz' // Automatically add to a local pacman repo
}
}),
]
};
npm run make
dist/linux-unpacked), you can
trigger the plugin via its CLI:
npx electron-make-pacman
npx electron-make-pacman ./build-output/my-app-linux-x64
npx electron-make-pacman ./build-output --config ./pacman-config.json
pacman-config.json:
{
"options": {
"depends": ["gtk3", "nss", "alsa-lib"],
"icon": "./assets/icon.png",
"desktopCategories": ["Network", "Utility"]
}
}
src/
directory:
MakerPacman.ts (Entry Point
& Electron Binding):@electron-forge/maker-base. It
introduces the Maker to the Electron Forge system, performs platform
validations (ensuring it only runs on Linux platforms), and dispatches Forge
events to the packager.
packager.ts (Orchestrator
& Controller):tempDir), transporting icons,
copying application files, and sequentially spawning the makepkg
sub-process. It enforces
environment variables like PKGDEST to strictly control where
makepkg places its resulting
archives.
pkgbuilder.ts (Text &
PKGBUILD Generator):PKGBUILD string output
according to Arch Linux syntaxes. It orchestrates shell formatting strings
to install your application systematically (/opt/[app-name]),
configure the
.desktop shortcuts (/usr/share/applications), parse
Git URLs, and configure symlinks.
cli.ts (Command Line
Interface):packager.ts.
logger.ts:/tmp/pacman-[pkg-name]-[timestamp].
/src/app within the temporary
directory.pkgbuilder.ts
maps your system
architecture architecture (e.g., x86_64) against your provided
MakerOptions and generates
a highly specific PKGBUILD
file containing step-by-step Bash sequences intended for the Arch
package manager.
packager.ts
spawns a
background child process calling makepkg -cfd --noconfirm.chrome-sandbox via
chmod 4755), and
successfully builds the standard .pkg.tar.zst payload.
.pkg.tar.zst from
makepkg, moves it into
your requested Forge out/make directory, and
cleanly disposes of the /tmp environment variables.
Author: Osman Beyhan
❤️ Make via MDtoWeb