Simple source based package manager
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-07 02:59:53 -05:00
src remove redundant arrows 2026-10-07 02:59:53 -05:00
.gitignore INIT APKG 2026-10-04 20:18:10 +00:00
build.py INIT APKG 2026-10-04 20:18:10 +00:00
readme.md INIT APKG 2026-10-04 20:18:10 +00:00

APKG - (Awesome PKG! (Package))

WHAT IS APKG?

Its mostly meant to be a 2nd package manager (can be your only but in most places, probably not.) repos are done by git repositories because this package manager is

the repo dictates the scope so if you make a repo thats specifically for a apkg os then that dictates the scope to an os level but if you write it around the fact of assuming packages from a package manager then it operates as a 2ndary package manager

There is no offical apkg repository because there is no offical apkg. Its really up to you how you wanna use it!

SOURCE BASED!

basically youd go to /etc/apkg/ and then clone whatever repository you want and then youd configure your config to use it

JOBS = 16
PREFIX = "/usr"
DESTDIR = ""

from testrepo import *

in that example itd be getting it from my test repo!

MAKING YOUR OWN REPO / PACKAGES

This is a packagemanager that isnt tied to an os and was mainly made for my home server as a 2nd to apk for tools that were either VERY out of date in the alpine repos or just didnt exist.

For example omnisearch! In this example i will show you a repo that packages omnisearch

First wed need to write a init.py unless you just wanna import the packages indivisually which is possible its just not what i recommend.

# __init__.py
from .omnisearch import omnisearch
from .beaker import beaker

then wed write our packages

# omnisearch.py
import os
from pathlib import Path

omnisearch = package(
    name="omnisearch",
    version="abdf",
    source="https://codeberg.org/gabrielf/omnisearch/archive/aace4b8f91487d8cb6b7c6fcd38efaa0a83cf1cc.tar.gz",
    hash="abdfa1e2835b63f7183b4bba4a43ce1c1d460008c323b15ef22e24c265e863c2",
    depends=["beaker"],
)

@omnisearch.build
def build():
    env = os.environ.copy()
    
    if DESTDIR:
        env["C_INCLUDE_PATH"] = f"{DESTDIR}/usr/include:{DESTDIR}/include"
        env["CPLUS_INCLUDE_PATH"] = f"{DESTDIR}/usr/include:{DESTDIR}/include"
        env["LIBRARY_PATH"] = f"{DESTDIR}/usr/lib:{DESTDIR}/lib"

    run("make", f"-j{JOBS}", env=env)

@omnisearch.install
def install():
    dest = Path(DESTDIR) if DESTDIR else Path("/")
    bin_dir = dest / PREFIX.lstrip("/") / "bin"
    data_dir = dest / "etc/omnisearch"

    bin_dir.mkdir(parents=True, exist_ok=True)
    data_dir.mkdir(parents=True, exist_ok=True)

    run("install", "-m", "755", "bin/omnisearch", str(bin_dir / "omnisearch"))

    config_target = data_dir / "config.ini"
    if Path("example-config.ini").exists():
        if not config_target.exists():
            run("cp", "example-config.ini", str(config_target))

    for asset in ["templates", "static", "locales"]:
        if Path(asset).exists():
            run("cp", "-rf", asset, str(data_dir / asset))

And for beaker (its dependancy)

# beaker.py
from pathlib import Path

beaker = package(
    name="beaker",
    version="903c",
    source="https://codeberg.org/gabrielf/beaker/archive/acdd9e754a536d542099951e4c9a6acc8cdf1c51.tar.gz",
    hash="903c2e16fec8c2321b2cb9e0547ed6b5952475819fd3657340cc885ffc784ca9"
)

@beaker.build
def build():
    prefix_path = PREFIX.rstrip("/") if PREFIX != "/" else ""
    run("make", f"-j{JOBS}", f"INSTALL_PREFIX={prefix_path}/")

@beaker.install
def install():
    dest = Path(DESTDIR) if DESTDIR else Path("/")
    clean_prefix = PREFIX.lstrip("/")
    
    target_stage = dest / clean_prefix
    
    run("make", "install", f"INSTALL_PREFIX={target_stage}/")

Now because weve set this up our repo is finished. Youd wanna make it a git repository then git clone it into your /etc/apkg and then once youve done that add this line

from myrepo import *

and then after that you can just run

sudo apkg install omnisearch