PKG_CREATE(3)

πŸ“¦ version 2.7.5, in nixos 26.05, nixpkgs unstable

πŸ’– PKG_CREATE(3) β€” create packages πŸ’–

okay so bestie, welcome to the Library Functions Manual page for pkg_create, and yeah it lives in the libpkg library β€” this is the whole toolkit for making packages, and I'm gonna walk you through every single bit, no cap ✨


🌸 NAME 🌸

pkg_create, pkg_create_i, pkg_create_new, pkg_create_free, pkg_create_set_format, pkg_create_set_overwrite, pkg_create_set_compression_level, pkg_create_set_rootdir, pkg_create_set_output_dir, pkg_create_set_timestamp, pkg_create_set_compression_threads β€” create packages πŸŽ€

πŸ“š LIBRARY πŸ“š

library β€œlibpkg” β€” that's the one, periodt πŸ’…

✨ SYNOPSIS ✨

#include <pkg.h>

struct pkg_create *
pkg_create_new();

void
pkg_create_free(struct pkg_create *);

bool
pkg_create_set_format(struct pkg_create *, const char *);

void
pkg_create_set_compression_level(struct pkg_create *, int);

void
pkg_create_set_compression_threads(struct pkg_create *, int);

void
pkg_create_set_overwrite(struct pkg_create *, bool);

void
pkg_create_set_rootdir(struct pkg_create *, const char *);

void
pkg_create_set_output_dir(struct pkg_create *, const char *);

void
pkg_create_set_timestamp(struct pkg_create *, time_t);

int
pkg_create(struct pkg_create *, const char *, const char *, bool);

int
pkg_create_i(struct pkg_create *, struct pkg *, bool);

πŸ¦‹ DESCRIPTION πŸ¦‹

pkg_create_new() β€” allocates a shiny new struct pkg_create *, and bestie listen, you are the one who has to free it later with pkg_create_free(). Don't leave it hanging, that's not the vibe πŸ™ˆ

pkg_create_set_format() β€” picks the compression format, iconic. Default is "txz", unless pkg.conf(5) says otherwise πŸ‘‘. It returns false if the compression format is unknown, and in that case it falls back to the default format. So like, it recovers, slay.

pkg_create_set_compression_level() β€” takes an int argument, which is the compression level you're expecting. There are 3 special values it accepts, and they're lowkey the main characters:

  • INT_MIN β€” set the fastest compression format value πŸ”₯
  • 0 β€” set the default (as specified in libarchive) ⭐
  • INT_MAX β€” set the best compression ratio πŸ’…

pkg_create_set_compression_threads() β€” takes an int argument, the expected number of threads used during compression. Parallelize, queen 🧚

pkg_create_set_overwrite() β€” accepts a boolean that defines the default behaviour when creating a package if a local file already exists. And the default behaviour? It overwrites. Yes, it just goes for it πŸ’€

pkg_create_set_rootdir() β€” tells the program where to find the root directory used for packaging (this directory is also known as the staging area). If none is provided, pkg will consider /. Home sweet home 🏠

pkg_create_set_output_dir() β€” tells the program where to create the new packages. By default it will consider the current directory of the running program. Very "work where you are" of it 🫢

pkg_create_set_timestamp() β€” defines the timestamp to use as the creation and modification time for the files to be packaged. By default it uses the timestamp of the files on the filesystem. Time is fake but the mtime is real 😭


πŸŽ€ pkg_create() β€” from scratch πŸŽ€

pkg_create() creates a package from scratch using the metadata and plist as input. The metadata can be either directly a UCL manifest, or a directory containing multiple files:

  • +MANIFEST β€” the UCL manifest
  • +DESC β€” a textual description (optional)

shell scripts (optional):

  • +INSTALL β€” shell script that will be run during both post and pre install (DEPRECATED)
  • +PRE_INSTALL β€” shell script that will be run during pre install phase
  • +POST_INSTALL β€” shell script that will be run during post install phase
  • +DEINSTALL β€” shell script that will be run during both post and pre deinstall (DEPRECATED)
  • +PRE_DEINSTALL β€” shell script that will be run during pre deinstall phase
  • +POST_DEINSTALL β€” shell script that will be run during post deinstall phase
  • pkg-install β€” shell script that will be run during both post and pre install (DEPRECATED)
  • pkg-pre-install β€” shell script that will be run during pre install phase
  • pkg-post-install β€” shell script that will be run during post install phase
  • pkg-deinstall β€” shell script that will be run during both post and pre deinstall (DEPRECATED)
  • pkg-pre-deinstall β€” shell script that will be run during pre deinstall phase
  • pkg-post-deinstall β€” shell script that will be run during post deinstall phase

lua scripts (optional):

  • pkg-pre-install.lua β€” Lua script that will be run during pre install phase
  • pkg-post-install.lua β€” Lua script that will be run during post install phase
  • pkg-pre-deinstall.lua β€” Lua script that will be run during pre deinstall phase
  • pkg-post-deinstall.lua β€” Lua script that will be run during post deinstall phase
🫢 quick note bestie: those +INSTALL / +DEINSTALL / pkg-install / pkg-deinstall ones are marked DEPRECATED in the original. They still get listed, but like… use the phase-specific ones, iykyk.

🌈 pkg_create_i() β€” for an installed pkg 🌈

pkg_create_i() creates a package for the provided installed pkg. If hash is set to true then the file name will be in the form:

<pkgname>-<pkgversion>-<shorthash>.<extention>

instead of:

<pkgname>-<pkgversion>.<extension>

(and yes, the original really does spell it extention the first time β€” character for character, we don't edit, we respect πŸ’–)


and that's the whole page, bestie β€” you ate that 🌟 from the Debian crew, dated December 12, 2025, signing off with all the love πŸ’œπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from