Jump to content

pm-user-repository

From Hugo's wiki

The pm user repository is a community registry of package definitions for pm. Its ur module lets pm install packages from Lua definitions hosted in the repository: you write a short config, ur downloads and runs the definition, and pm uses the returned table to fetch, build and install the binary.

How it works

  1. You download ur.lua into your pm config directory.
  2. Your init.lua requires it and calls ur.Fetch { ... } for each package.
  3. ur.Fetch downloads the Lua file from the repository over HTTPS, loads it in text-only mode (which blocks bytecode injection) and pcalls it to get the table.
  4. pm consumes the table to handle download, build and install.

The ur.Github helper covers the common case: fetch a tarball from a GitHub repository, extract it, run make (or a custom build command) and return the artifact path. It can use gh auth token for authenticated API requests (5000 requests per hour instead of 60).

Usage

Download the module:

$ mkdir -p ~/.config/pm && curl -o ~/.config/pm/ur.lua https://raw.githubusercontent.com/hugoocoto/pm-user-repository/refs/heads/main/ur.lua

Then use it from init.lua:

local ur = require("ur")

Packages = {
    ur.Fetch { user = "hugoocoto", file = "nvim-nightly/nvim.lua" },
    ur.Fetch { user = "hugoocoto", file = "helium/helium.lua" },
}

Available packages

File Package
b/b.lua b web browser
dv/dv.lua dv directory viewer
eqnx/eqnx.lua eqnx (archived)
fetch/fetch.lua fetch system info fetcher
helium/helium.lua Helium AppImage
infinipaint/infinipaint.lua InfiniPaint painting application
isf/isf.lua isf two-way folder sync over ssh
mybar/mybar.lua mybar Wayland status bar
nvim-nightly/nvim.lua Neovim nightly AppImage
pdfjoin/pdfjoin.lua pdfjoin PDF merger
send2kodi/send2kodi.lua send2kodi links and local media to Kodi
st/st.lua st simple terminal
tetris/tetris.lua tetris terminal game
todo/todo.lua todo task manager
tui-do/tui-do.lua tui-do task list
vicel/vicel.lua vicel spreadsheet editor
wallpaper/wallpaper.lua wallpaper for Wayland
wl2kodi/wl2kodi.lua wl2kodi screen mirroring to Kodi
yaci/yaci.lua yaci calculator REPL
zrun/zrun.lua zrun fuzzy launcher

All of them are under the hugoocoto user directory.

Package format

Each .lua file returns a table:

Field Required Description
url Yes Download URL for a source archive or binary
build Yes Shell commands that produce the executable
name No File name for the download (inferred from the URL if absent)
artifact Yes, unless name is set Executable produced by build
last_modified_cmd No Command to check the remote Last-Modified date
return {
    url = "https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.appimage",
    name = "nvim",
    build = "chmod +x nvim",
}

Contributing

  1. Fork the repository.
  2. Create a directory named after your GitHub username.
  3. Add your .lua files inside it (subdirectories are fine, like username/tool/tool.lua). A README.md next to it renders on the docs page.
  4. Open a pull request. CI validates the Lua syntax and the root structure.
Warning Do not include tokens, passwords or private keys. Only ur.lua lives at the root.

See also