diff --git a/pkgs/applications/science/astronomy/stellarium/default.nix b/pkgs/applications/science/astronomy/stellarium/default.nix index 426a7f18dff3..87118beec99f 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";