Files
nixpkgs/pkgs/by-name/ja/jasp-desktop/package.nix
2026-07-26 08:39:41 +10:00

142 lines
3.6 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
buildEnv,
linkFarm,
writers,
cmake,
ninja,
pkg-config,
boost,
freexl,
libarchive,
librdata,
libsodium,
qt6,
R,
readstat,
rPackages,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "jasp-desktop";
version = "0.98.1";
src = fetchFromGitHub {
owner = "jasp-stats";
repo = "jasp-desktop";
tag = "v${finalAttrs.version}";
fetchSubmodules = true;
hash = "sha256-73RxbWVa03V6MdcW9k4Hv8EBsSNw0Feg91SioWLgC5U=";
};
patches = [
./boost.patch # link boost dynamically
./disable-module-install-logic.patch # don't try to install modules via cmake
./disable-renv-logic.patch
./dont-check-for-module-deps.patch # dont't check for dependencies required for building modules
];
cmakeFlags = [
(lib.cmakeFeature "GITHUB_PAT" "dummy")
(lib.cmakeFeature "GITHUB_PAT_DEF" "dummy")
(lib.cmakeBool "LINUX_LOCAL_BUILD" false)
(lib.cmakeBool "INSTALL_R_MODULES" false)
(lib.cmakeFeature "CUSTOM_R_PATH" "${finalAttrs.passthru.customREnv}")
];
nativeBuildInputs = [
cmake
ninja
pkg-config
qt6.wrapQtAppsHook
];
buildInputs = [
finalAttrs.passthru.customREnv
boost
freexl
libarchive
librdata
libsodium
readstat
qt6.qtbase
qt6.qtdeclarative
qt6.qtwebengine
qt6.qthttpserver
];
# needed so that the linker can find libRInside.so
env.NIX_LDFLAGS = "-L${rPackages.RInside}/library/RInside/lib";
postInstall = ''
# Remove flatpak proxy script
rm $out/bin/org.jaspstats.JASP
substituteInPlace $out/share/applications/org.jaspstats.JASP.desktop \
--replace-fail "Exec=org.jaspstats.JASP" "Exec=JASP"
# symlink modules from the store
ln -s ${finalAttrs.passthru.moduleLibs} $out/Modules/module_libs
ln -s ${finalAttrs.passthru.moduleManifests} $out/Modules/manifests
'';
passthru = {
inherit
(import ./modules.nix {
inherit lib fetchFromGitHub rPackages;
jasp-src = finalAttrs.src;
jasp-version = finalAttrs.version;
})
customRPackages
jaspModules
;
# Merges ${R}/lib/R with all used R packages (even propagated ones)
customREnv = buildEnv {
name = "jasp-desktop-${finalAttrs.version}-env";
paths = [
"${R}/lib/R"
rPackages.RInside
finalAttrs.passthru.customRPackages.jaspBase # Should already be propagated from modules, but include it again, just in case
]
++ lib.attrValues finalAttrs.passthru.jaspModules;
};
moduleLibs = linkFarm "jasp-desktop-${finalAttrs.version}-module-libs" (
lib.mapAttrsToList (name: drv: {
name = name;
path = "${drv}/library";
}) finalAttrs.passthru.jaspModules
);
moduleManifests = linkFarm "jasp-desktop-${finalAttrs.version}-module-manifests" (
lib.mapAttrsToList (name: drv: {
name = "${name}_manifest.json";
path = writers.writeJSON "${name}_manifest.json" {
name = name;
version = drv.version;
};
}) finalAttrs.passthru.jaspModules
);
updateScript = ./update.sh;
};
meta = {
changelog = "https://jasp-stats.org/release-notes";
description = "Complete statistical package for both Bayesian and Frequentist statistical methods";
homepage = "https://github.com/jasp-stats/jasp-desktop";
license = lib.licenses.agpl3Plus;
mainProgram = "JASP";
maintainers = with lib.maintainers; [ tomasajt ];
# JASP's cmake build steps are really different on Darwin
# Perhaps the Darwin-specific things could be changed to be the same as Linux
platforms = lib.platforms.linux;
};
})