From 44718e84d9a1cc3afbf767907006f2b99b210b00 Mon Sep 17 00:00:00 2001 From: Daniel Nagy Date: Mon, 31 Mar 2025 11:00:00 +0200 Subject: [PATCH] glab: use finalAttrs pattern and writableTmpDirAsHomeHook --- pkgs/by-name/gl/glab/package.nix | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/gl/glab/package.nix b/pkgs/by-name/gl/glab/package.nix index cabeb20d2543..d14b0cb538ad 100644 --- a/pkgs/by-name/gl/glab/package.nix +++ b/pkgs/by-name/gl/glab/package.nix @@ -5,16 +5,17 @@ installShellFiles, stdenv, nix-update-script, + writableTmpDirAsHomeHook, }: -buildGoModule rec { +buildGoModule (finalAttrs: { pname = "glab"; version = "1.55.0"; src = fetchFromGitLab { owner = "gitlab-org"; repo = "cli"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-K1zjb4QCLBp7GwT2580DXYKx3yTaIyNytKObMbzjvlQ="; }; @@ -23,13 +24,10 @@ buildGoModule rec { ldflags = [ "-s" "-w" - "-X main.version=${version}" + "-X main.version=${finalAttrs.version}" ]; - preCheck = '' - # failed to read configuration: mkdir /homeless-shelter: permission denied - export HOME=$TMPDIR - ''; + nativeCheckInputs = [ writableTmpDirAsHomeHook ]; subPackages = [ "cmd/glab" ]; @@ -50,11 +48,11 @@ buildGoModule rec { description = "GitLab CLI tool bringing GitLab to your command line"; license = lib.licenses.mit; homepage = "https://gitlab.com/gitlab-org/cli"; - changelog = "https://gitlab.com/gitlab-org/cli/-/releases/v${version}"; + changelog = "https://gitlab.com/gitlab-org/cli/-/releases/v${finalAttrs.version}"; maintainers = with lib.maintainers; [ freezeboy luftmensch-luftmensch ]; mainProgram = "glab"; }; -} +})