From b5c0eb0b9067d87a6759bba56ec8da7fd9e733f8 Mon Sep 17 00:00:00 2001 From: kilianar Date: Thu, 14 Mar 2024 17:16:45 +0100 Subject: [PATCH] stellarium: add passthru.tests.version Add a passthru test to stellarium to verify it can be started and print its version. The test runs stellarium with a temporary home directory using xvfb-run, since stellarium requires a writable home directory and cannot be run in headless mode. --- .../science/astronomy/stellarium/default.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkgs/applications/science/astronomy/stellarium/default.nix b/pkgs/applications/science/astronomy/stellarium/default.nix index 687c0b3a2dda..30c1cfd542a9 100644 --- a/pkgs/applications/science/astronomy/stellarium/default.nix +++ b/pkgs/applications/science/astronomy/stellarium/default.nix @@ -20,6 +20,8 @@ , qttools , exiv2 , nlopt +, testers +, xvfb-run }: stdenv.mkDerivation (finalAttrs: { @@ -93,6 +95,18 @@ stdenv.mkDerivation (finalAttrs: { qtWrapperArgs+=("''${gappsWrapperArgs[@]}") ''; + passthru.tests.version = testers.testVersion { + package = finalAttrs.finalPackage; + command = '' + # Create a temporary home directory because stellarium aborts with an + # error if it can't write some configuration files. + tmpdir=$(mktemp -d) + + # stellarium can't be run in headless mode, therefore we need xvfb-run. + HOME="$tmpdir" ${xvfb-run}/bin/xvfb-run stellarium --version + ''; + }; + meta = { description = "Free open-source planetarium"; mainProgram = "stellarium";