diff --git a/pkgs/applications/science/astronomy/kstars/default.nix b/pkgs/applications/science/astronomy/kstars/default.nix index 66fc3ec600f8..c32d671cb05d 100644 --- a/pkgs/applications/science/astronomy/kstars/default.nix +++ b/pkgs/applications/science/astronomy/kstars/default.nix @@ -9,20 +9,23 @@ eigen, zlib, - cfitsio, indilib, xplanet, libnova, libraw, gsl, wcslib + cfitsio, indilib, xplanet, libnova, libraw, gsl, wcslib, stellarsolver }: mkDerivation rec { pname = "kstars"; - version = "3.4.3"; + version = "3.5.0"; src = fetchurl { - url = "https://mirrors.mit.edu/kde/stable/kstars/kstars-${version}.tar.xz"; - sha256 = "0j5yxg6ay6sic194skz6vjzg6yvrpb3gvypvs0frjrcjbsl1j4f8"; + url = "mirror://kde/stable/kstars/kstars-${version}.tar.xz"; + sha256 = "0fpkm75abn0hhdhfyvpfl6n0fr7gvw63xhb4hvwdrglhkf2nxam1"; }; patches = [ - ./indi-fix.patch + # Patches ksutils.cpp to use nix store prefixes to find program binaries of + # indilib and xplanet dependencies. Without the patch, Ekos is unable to spawn + # indi servers for local telescope/camera control. + ./fs-fixes.patch ]; nativeBuildInputs = [ extra-cmake-modules kdoctools ]; @@ -34,11 +37,12 @@ mkDerivation rec { eigen zlib - cfitsio indilib xplanet libnova libraw gsl wcslib + cfitsio indilib xplanet libnova libraw gsl wcslib stellarsolver ]; cmakeFlags = [ "-DINDI_NIX_ROOT=${indilib}" + "-DXPLANET_NIX_ROOT=${xplanet}" ]; meta = with lib; { @@ -51,6 +55,6 @@ mkDerivation rec { ''; license = licenses.gpl2; platforms = platforms.linux; - maintainers = with maintainers; [ timput ]; + maintainers = with maintainers; [ timput hjones2199 ]; }; } diff --git a/pkgs/applications/science/astronomy/kstars/fs-fixes.patch b/pkgs/applications/science/astronomy/kstars/fs-fixes.patch new file mode 100644 index 000000000000..b9bdfc0c5dea --- /dev/null +++ b/pkgs/applications/science/astronomy/kstars/fs-fixes.patch @@ -0,0 +1,59 @@ +--- kstars-3.5.0/CMakeLists.txt.old 2020-11-24 12:36:37.967433937 -0600 ++++ kstars-3.5.0/CMakeLists.txt 2020-11-24 13:36:56.275263691 -0600 +@@ -5,6 +5,9 @@ + set (KSTARS_BUILD_RELEASE "Stable") + set (CMAKE_CXX_STANDARD 11) + ++add_definitions(-DINDI_NIX_ROOT=${INDI_NIX_ROOT}) ++add_definitions(-DXPLANET_NIX_ROOT=${XPLANET_NIX_ROOT}) ++ + # Build KStars Lite with -DBUILD_KSTARS_LITE=ON + option(BUILD_KSTARS_LITE "Build KStars Lite" OFF) + +--- kstars-3.5.0/kstars/auxiliary/ksutils.old.cpp 2020-11-24 12:22:14.397319680 -0600 ++++ kstars-3.5.0/kstars/auxiliary/ksutils.cpp 2020-11-24 13:32:22.946477798 -0600 +@@ -1081,6 +1081,10 @@ + // We support running within Snaps, Flatpaks, and AppImage + // The path should accomodate the differences between the different + // packaging solutions ++ #define STR_EXPAND(x) #x ++ #define STR(x) STR_EXPAND(x) ++ QString indi_prefix = QString(STR(INDI_NIX_ROOT)); ++ QString xplanet_prefix = QString(STR(XPLANET_NIX_ROOT)); + QString snap = QProcessEnvironment::systemEnvironment().value("SNAP"); + QString flat = QProcessEnvironment::systemEnvironment().value("FLATPAK_DEST"); + QString appimg = QProcessEnvironment::systemEnvironment().value("APPDIR"); +@@ -1110,21 +1114,21 @@ + #if defined(Q_OS_OSX) + return "/usr/local/bin/indiserver"; + #endif +- return prefix + "/bin/indiserver"; ++ return indi_prefix + "/bin/indiserver"; + } + else if (option == "INDIHubAgent") + { + #if defined(Q_OS_OSX) + return "/usr/local/bin/indihub-agent"; + #endif +- return prefix + "/bin/indihub-agent"; ++ return indi_prefix + "/bin/indihub-agent"; + } + else if (option == "indiDriversDir") + { + #if defined(Q_OS_OSX) + return "/usr/local/share/indi"; + #elif defined(Q_OS_LINUX) +- return prefix + "/share/indi"; ++ return indi_prefix + "/share/indi"; + #else + return QStandardPaths::locate(QStandardPaths::GenericDataLocation, "indi", QStandardPaths::LocateDirectory); + #endif +@@ -1181,7 +1185,7 @@ + #if defined(Q_OS_OSX) + return "/usr/local/bin/xplanet"; + #endif +- return prefix + "/bin/xplanet"; ++ return xplanet_prefix + "/bin/xplanet"; + } + else if (option == "ASTAP") + { diff --git a/pkgs/applications/science/astronomy/kstars/indi-fix.patch b/pkgs/applications/science/astronomy/kstars/indi-fix.patch deleted file mode 100644 index 9ff9f8a31dd3..000000000000 --- a/pkgs/applications/science/astronomy/kstars/indi-fix.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- CMakeLists.txt 2020-11-02 13:58:06.119743710 -0600 -+++ kstars-3.4.3/CMakeLists.txt 2020-11-02 14:05:01.707799274 -0600 -@@ -4,5 +4,7 @@ - set (KStars_VERSION_REVISION 3) - set (CMAKE_CXX_STANDARD 11) - -+add_definitions(-DINDI_NIX_ROOT=${INDI_NIX_ROOT}) -+ - # Build KStars Lite with -DBUILD_KSTARS_LITE=ON - option(BUILD_KSTARS_LITE "Build KStars Lite" OFF) - ---- ksutils.cpp 2020-11-02 13:47:44.883596916 -0600 -+++ kstars-3.4.3/kstars/auxiliary/ksutils.cpp 2020-11-02 17:41:44.961937090 -0600 -@@ -1076,6 +1076,9 @@ - { - QString snap = QProcessEnvironment::systemEnvironment().value("SNAP"); - QString flat = QProcessEnvironment::systemEnvironment().value("FLATPAK_DEST"); -+#define STR_EXPAND(x) #x -+#define STR(x) STR_EXPAND(x) -+ QString nix = QString(STR(INDI_NIX_ROOT)); - - if (option == "fitsDir") - { -@@ -1089,7 +1091,7 @@ - if (flat.isEmpty() == false) - return flat + "/bin/indiserver"; - else -- return snap + "/usr/bin/indiserver"; -+ return nix + "/bin/indiserver"; - } - else if (option == "INDIHubAgent") - { -@@ -1099,7 +1101,7 @@ - if (flat.isEmpty() == false) - return flat + "/bin/indihub-agent"; - else -- return snap + "/usr/bin/indihub-agent"; -+ return nix + "/bin/indihub-agent"; - } - else if (option == "indiDriversDir") - { -@@ -1109,7 +1111,7 @@ - if (flat.isEmpty() == false) - return flat + "/share/indi"; - else -- return snap + "/usr/share/indi"; -+ return nix + "/share/indi"; - #else - return QStandardPaths::locate(QStandardPaths::GenericDataLocation, "indi", QStandardPaths::LocateDirectory); - #endif diff --git a/pkgs/development/libraries/stellarsolver/default.nix b/pkgs/development/libraries/stellarsolver/default.nix new file mode 100644 index 000000000000..69417299615b --- /dev/null +++ b/pkgs/development/libraries/stellarsolver/default.nix @@ -0,0 +1,30 @@ +{ stdenv, mkDerivation, fetchFromGitHub, cmake, + qtbase, cfitsio, gsl, wcslib, withTester ? false }: + +mkDerivation rec { + pname = "stellarsolver"; + version = "1.5"; + + src = fetchFromGitHub { + owner = "rlancaste"; + repo = pname; + rev = version; + sha256 = "12j20j9qbkkx55ix4nm1iw7wd36hamkpidbwhcnmj4yk5fqlyq4y"; + }; + + nativeBuildInputs = [ cmake ]; + + buildInputs = [ qtbase cfitsio gsl wcslib ]; + + cmakeFlags = [ + "-DBUILD_TESTER=${if withTester then "on" else "off"}" + ]; + + meta = with stdenv.lib; { + homepage = "https://github.com/rlancaste/stellarsolver"; + description = "Astrometric plate solving library"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ hjones2199 ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3e71a52c2341..ab17e2300350 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -27501,6 +27501,8 @@ in stellarium = libsForQt5.callPackage ../applications/science/astronomy/stellarium { }; + stellarsolver = libsForQt5.callPackage ../development/libraries/stellarsolver { }; + astrolabe-generator = callPackage ../applications/science/astronomy/astrolabe-generator { }; tulip = callPackage ../applications/science/misc/tulip {