From b611ce9c3df1006e9722179c71d730778af5d9d9 Mon Sep 17 00:00:00 2001 From: Ethan Carter Edwards Date: Wed, 23 Jul 2025 18:49:10 -0400 Subject: [PATCH] nix-init: modernize Signed-off-by: Ethan Carter Edwards --- pkgs/by-name/ni/nix-init/package.nix | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/pkgs/by-name/ni/nix-init/package.nix b/pkgs/by-name/ni/nix-init/package.nix index 0f996a78bf6b..f11d31556646 100644 --- a/pkgs/by-name/ni/nix-init/package.nix +++ b/pkgs/by-name/ni/nix-init/package.nix @@ -11,12 +11,11 @@ openssl, zlib, zstd, - stdenv, spdx-license-list-data, nix, nurl, - testers, - nix-init, + versionCheckHook, + nix-update-script, }: let @@ -25,14 +24,14 @@ let }; in -rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage (finalAttrs: { pname = "nix-init"; version = "0.3.2"; src = fetchFromGitHub { owner = "nix-community"; repo = "nix-init"; - rev = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-0RLEPVtYnwYH+pMnpO0/Evbp7x9d0RMobOVAqwgMJz4="; }; @@ -87,16 +86,18 @@ rustPlatform.buildRustPackage rec { ZSTD_SYS_USE_PKG_CONFIG = true; }; - passthru.tests.version = testers.testVersion { - package = nix-init; - }; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = "--version"; + doInstallCheck = true; - meta = with lib; { + passthru.updateScript = nix-update-script { }; + + meta = { description = "Command line tool to generate Nix packages from URLs"; mainProgram = "nix-init"; homepage = "https://github.com/nix-community/nix-init"; - changelog = "https://github.com/nix-community/nix-init/blob/${src.rev}/CHANGELOG.md"; - license = licenses.mpl20; - maintainers = with maintainers; [ figsoda ]; + changelog = "https://github.com/nix-community/nix-init/blob/${finalAttrs.src.tag}/CHANGELOG.md"; + license = lib.licenses.mpl20; + maintainers = with lib.maintainers; [ figsoda ]; }; -} +})