The package targeted pkgit 0.0.11 from the abandoned GitHub mirror (dacctal/pkgit), the old Nim implementation. Real upstream (https://git.symlinx.net/pkgit) has since rewritten pkgit in C and released up to 1.1.3. Repackage against real upstream: - build the C sources (Makefile + luajit) via stdenv.mkDerivation, fetching from git.symlinx.net with fetchgit (drops buildNimPackage and lock.json) - patch main() so -v/--version and -h/--help respond before the Lua config is loaded, so they work without a config and versionCheckHook (now correctly wired via doInstallCheck/nativeInstallCheckInputs) can use them - wrap with git on PATH (runtime dependency, src/fetch_git.c) Assisted-by: Claude Code (claude-opus-4-8)
46 lines
1.3 KiB
Diff
46 lines
1.3 KiB
Diff
From 366607d5e2bc8a7e067105f1c0d0e6c2c235c131 Mon Sep 17 00:00:00 2001
|
|
From: Philip Taron <philip.taron@gmail.com>
|
|
Date: Mon, 29 Jun 2026 10:04:36 -0700
|
|
Subject: [PATCH] main: handle --version/--help before loading the Lua config
|
|
|
|
main() loads the Lua configuration before parsing arguments, and the
|
|
loader exits when no config file exists. That makes `pkgit --version`
|
|
and `pkgit --help` fail on a fresh install. Answer those informational
|
|
flags first so they work without a config.
|
|
---
|
|
src/main.c | 13 +++++++++++++
|
|
1 file changed, 13 insertions(+)
|
|
|
|
diff --git a/src/main.c b/src/main.c
|
|
index 9010d3e..4c45b8a 100644
|
|
--- a/src/main.c
|
|
+++ b/src/main.c
|
|
@@ -1,4 +1,5 @@
|
|
#include <stdio.h>
|
|
+#include <string.h>
|
|
|
|
#include "cla_parse.h"
|
|
#include "lua_state.h"
|
|
@@ -7,6 +8,18 @@
|
|
|
|
int main(int argc, char *argv[]) {
|
|
init_vars();
|
|
+
|
|
+ /* Respond to informational flags before loading the Lua config, which aborts
|
|
+ when no config file (~/.config/pkgit/init.lua) exists. This keeps
|
|
+ `pkgit --version` and `pkgit --help` usable on a fresh install. */
|
|
+ for (int i = 1; i < argc; i++) {
|
|
+ if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") ||
|
|
+ !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
|
|
+ cla_parse(argc, argv);
|
|
+ return 0;
|
|
+ }
|
|
+ }
|
|
+
|
|
init_lua_state();
|
|
setup_pkgit();
|
|
cache_repos();
|
|
--
|
|
2.54.0
|
|
|