From 8c02fa744cc844196bda2026afec329710ab48c5 Mon Sep 17 00:00:00 2001 From: gbhu753 Date: Thu, 25 Jun 2026 01:23:08 +1200 Subject: [PATCH 1/5] maintainers: add gbhu753 --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 76bf3a20c3a3..4d051839f6b8 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -9722,6 +9722,12 @@ githubId = 16470252; name = "Gemini Lasswell"; }; + gbhu753 = { + email = "me@gurjotbhullar.com"; + github = "GBHU753"; + githubId = 100983240; + name = "Gurjot Bhullar"; + }; gbtb = { email = "goodbetterthebeast3@gmail.com"; github = "gbtb"; From 860aca60fd9f6eb7f7c254783ed08a92b165a27f Mon Sep 17 00:00:00 2001 From: gbhu753 Date: Thu, 25 Jun 2026 01:23:11 +1200 Subject: [PATCH 2/5] modctl: init at 0.2.2 --- pkgs/by-name/mo/modctl/package.nix | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 pkgs/by-name/mo/modctl/package.nix diff --git a/pkgs/by-name/mo/modctl/package.nix b/pkgs/by-name/mo/modctl/package.nix new file mode 100644 index 000000000000..cc7225ebe2dc --- /dev/null +++ b/pkgs/by-name/mo/modctl/package.nix @@ -0,0 +1,43 @@ +{ + lib, + buildGoModule, + fetchFromGitHub, +}: + +buildGoModule rec { + __structuredAttrs = true; + pname = "modctl"; + version = "0.2.2"; + + src = fetchFromGitHub { + owner = "modelpack"; + repo = "modctl"; + rev = "v${version}"; + hash = "sha256-A7s2jM+hR5WgeiWzPjjfS/AJy35x6kzewIucz713zLc="; + }; + + vendorHash = "sha256-S1ygAZO3bTFi/3pwmNYE7P/Vqg7AVHpH5YRJ3yzzvyo="; + + ldflags = [ + "-s" + "-w" + "-X github.com/modelpack/modctl/pkg/version.GitVersion=v${version}" + ]; + + doInstallCheck = true; + installCheckPhase = '' + runHook preInstallCheck + $out/bin/modctl --help > /dev/null + $out/bin/modctl version 2>&1 | grep -q "v${version}" + runHook postInstallCheck + ''; + + meta = { + description = "CLI tool for managing OCI model artifacts based on Model Spec"; + homepage = "https://github.com/modelpack/modctl"; + changelog = "https://github.com/modelpack/modctl/releases/tag/v${version}"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ gbhu753 ]; + mainProgram = "modctl"; + }; +} From cacd8e4dbbc39926977c68cb1ba9b0de86e3ae2d Mon Sep 17 00:00:00 2001 From: gbhu753 Date: Sun, 28 Jun 2026 18:24:27 +1200 Subject: [PATCH 3/5] modctl: fix install check on aarch64-darwin modctl creates a ~/.modctl directory before running any cobra command. Go's os/user package doesn't respect $HOME on darwin and does system calls directly, so the installCheckPhase fails there. Pass --log-dir and --storage-dir pointing at $TMPDIR to avoid touching $HOME. --- pkgs/by-name/mo/modctl/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/mo/modctl/package.nix b/pkgs/by-name/mo/modctl/package.nix index cc7225ebe2dc..bb82464ff705 100644 --- a/pkgs/by-name/mo/modctl/package.nix +++ b/pkgs/by-name/mo/modctl/package.nix @@ -28,7 +28,7 @@ buildGoModule rec { installCheckPhase = '' runHook preInstallCheck $out/bin/modctl --help > /dev/null - $out/bin/modctl version 2>&1 | grep -q "v${version}" + $out/bin/modctl version --log-dir="$TMPDIR" --storage-dir="$TMPDIR" 2>&1 | grep -q "v${version}" runHook postInstallCheck ''; From b5bf4ab5500d97ac2ebe34a546a5755f825e6805 Mon Sep 17 00:00:00 2001 From: gbhu753 Date: Tue, 30 Jun 2026 01:11:46 +1200 Subject: [PATCH 4/5] modctl: use versionCheckHook and finalAttrs Replace the manual installCheckPhase with versionCheckHook and writableTmpDirAsHomeHook, matching the pattern used by other Go CLI packages (e.g. nerdctl, temporal-cli). This supersedes the aarch64-darwin workaround in cacd8e4dbbc3: writableTmpDirAsHomeHook sets HOME to a writable directory, so modctl no longer needs explicit --log-dir/--storage-dir flags to avoid the os/user system calls that broke the install check on darwin. Also switch rec -> finalAttrs, use tag instead of rev in fetchFromGitHub, and drop the redundant -w ldflag (implied by -s). Assisted-by: opencode (GLM-5.2) --- pkgs/by-name/mo/modctl/package.nix | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/pkgs/by-name/mo/modctl/package.nix b/pkgs/by-name/mo/modctl/package.nix index bb82464ff705..eb149689558f 100644 --- a/pkgs/by-name/mo/modctl/package.nix +++ b/pkgs/by-name/mo/modctl/package.nix @@ -2,9 +2,11 @@ lib, buildGoModule, fetchFromGitHub, + versionCheckHook, + writableTmpDirAsHomeHook, }: -buildGoModule rec { +buildGoModule (finalAttrs: { __structuredAttrs = true; pname = "modctl"; version = "0.2.2"; @@ -12,7 +14,7 @@ buildGoModule rec { src = fetchFromGitHub { owner = "modelpack"; repo = "modctl"; - rev = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-A7s2jM+hR5WgeiWzPjjfS/AJy35x6kzewIucz713zLc="; }; @@ -20,24 +22,23 @@ buildGoModule rec { ldflags = [ "-s" - "-w" - "-X github.com/modelpack/modctl/pkg/version.GitVersion=v${version}" + "-X github.com/modelpack/modctl/pkg/version.GitVersion=v${finalAttrs.version}" ]; doInstallCheck = true; - installCheckPhase = '' - runHook preInstallCheck - $out/bin/modctl --help > /dev/null - $out/bin/modctl version --log-dir="$TMPDIR" --storage-dir="$TMPDIR" 2>&1 | grep -q "v${version}" - runHook postInstallCheck - ''; + nativeInstallCheckInputs = [ + writableTmpDirAsHomeHook + versionCheckHook + ]; + versionCheckProgramArg = "version"; + versionCheckKeepEnvironment = [ "HOME" ]; meta = { description = "CLI tool for managing OCI model artifacts based on Model Spec"; homepage = "https://github.com/modelpack/modctl"; - changelog = "https://github.com/modelpack/modctl/releases/tag/v${version}"; + changelog = "https://github.com/modelpack/modctl/releases/tag/v${finalAttrs.version}"; license = lib.licenses.asl20; maintainers = with lib.maintainers; [ gbhu753 ]; mainProgram = "modctl"; }; -} +}) From c80d453e9ced5d380a508a1e2f1624fe785eb984 Mon Sep 17 00:00:00 2001 From: gbhu753 Date: Tue, 30 Jun 2026 01:49:45 +1200 Subject: [PATCH 5/5] modctl: fix darwin install check with versionCheckHook modctl's cobra commands invoke config.NewRoot(), which resolves the home directory via os/user.Current(). On darwin os/user bypasses $HOME and calls getpwuid directly, returning /var/empty for the nixbld user, so writableTmpDirAsHomeHook (which only sets $HOME) cannot redirect the .modctl directory and the install check fails with "mkdir /var/empty/.modctl: operation not permitted". Drop writableTmpDirAsHomeHook and instead use preVersionCheck to point versionCheckProgram at a small wrapper that appends --log-dir/--storage-dir=$TMPDIR, mirroring the flags the previous manual installCheckPhase used. versionCheckHook still performs the actual --version/--help invocation, output capture, and ${version} matching. Assisted-by: opencode (GLM-5.2) --- pkgs/by-name/mo/modctl/package.nix | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pkgs/by-name/mo/modctl/package.nix b/pkgs/by-name/mo/modctl/package.nix index eb149689558f..c910dd3112ad 100644 --- a/pkgs/by-name/mo/modctl/package.nix +++ b/pkgs/by-name/mo/modctl/package.nix @@ -3,7 +3,6 @@ buildGoModule, fetchFromGitHub, versionCheckHook, - writableTmpDirAsHomeHook, }: buildGoModule (finalAttrs: { @@ -26,12 +25,25 @@ buildGoModule (finalAttrs: { ]; doInstallCheck = true; - nativeInstallCheckInputs = [ - writableTmpDirAsHomeHook - versionCheckHook - ]; + nativeInstallCheckInputs = [ versionCheckHook ]; versionCheckProgramArg = "version"; - versionCheckKeepEnvironment = [ "HOME" ]; + + # modctl's cobra commands invoke config.NewRoot(), which uses + # os/user.Current() to find the home directory. On darwin os/user + # bypasses $HOME and resolves it via getpwuid (returning /var/empty, + # not writable), so the install check fails. versionCheckHook only + # accepts a single argument, so wrap the binary and point + # --log-dir/--storage-dir at TMPDIR to keep the check working on all + # platforms. + preVersionCheck = '' + wrapper="$NIX_BUILD_TOP/modctl-version-check" + cat > "$wrapper" <