diff --git a/pkgs/by-name/ap/apfsprogs/package.nix b/pkgs/by-name/ap/apfsprogs/package.nix index 42175558be32..53b374f77975 100644 --- a/pkgs/by-name/ap/apfsprogs/package.nix +++ b/pkgs/by-name/ap/apfsprogs/package.nix @@ -3,30 +3,34 @@ stdenv, fetchFromGitHub, nixosTests, + testers, }: - +let + tools = [ + "apfsck" + "apfs-label" + "apfs-snap" + "mkapfs" + ]; +in stdenv.mkDerivation (finalAttrs: { pname = "apfsprogs"; - version = "0-unstable-2024-09-27"; + version = "0.2.0"; src = fetchFromGitHub { owner = "linux-apfs"; repo = "apfsprogs"; - rev = "f31d7c2d69d212ce381399d2bb1e91410f592484"; - hash = "sha256-+c+wU52XKNOTxSpSrkrNWoGEYw6Zo4CGEOyKMvkXEa0="; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-rolbBLdE98jqlKC06fTo6eJU3abKzgB3QIlaw4bza9U="; }; - postPatch = - let - shortRev = builtins.substring 0 9 finalAttrs.src.rev; - in - '' - substituteInPlace \ - apfs-snap/Makefile apfsck/Makefile mkapfs/Makefile apfs-label/Makefile \ - --replace-fail \ - '$(shell git describe --always HEAD | tail -c 9)' \ - '${shortRev}' - ''; + postPatch = '' + substituteInPlace \ + apfs-snap/Makefile apfsck/Makefile mkapfs/Makefile apfs-label/Makefile \ + --replace-fail \ + '$(shell git describe --always HEAD | tail -c 9)' \ + 'v${finalAttrs.version}' + ''; buildPhase = '' runHook preBuild @@ -46,15 +50,30 @@ stdenv.mkDerivation (finalAttrs: { runHook postInstall ''; - passthru.tests = { - apfs = nixosTests.apfs; - }; + passthru.tests = + let + mkVersionTest = tool: { + "version-${tool}" = testers.testVersion { + package = finalAttrs.finalPackage; + command = "${tool} -v"; + version = "v${finalAttrs.version}"; + }; + }; + versionTestList = builtins.map mkVersionTest tools; + + versionTests = lib.mergeAttrsList versionTestList; + in + { + apfs = nixosTests.apfs; + } + // versionTests; strictDeps = true; meta = with lib; { description = "Experimental APFS tools for linux"; homepage = "https://github.com/linux-apfs/apfsprogs"; + changelog = "https://github.com/linux-apfs/apfsprogs/releases/tag/v${finalAttrs.version}"; license = licenses.gpl2Only; platforms = platforms.linux; maintainers = with maintainers; [ Luflosi ];