jasp-desktop: refactor to use finalAttrs

This commit is contained in:
TomaSajt
2026-01-19 23:53:18 +01:00
parent b0f80d5cc9
commit c3040d2675
+34 -39
View File
@@ -21,47 +21,17 @@
rPackages,
}:
let
stdenv.mkDerivation (finalAttrs: {
pname = "jasp-desktop";
version = "0.95.4";
src = fetchFromGitHub {
owner = "jasp-stats";
repo = "jasp-desktop";
tag = "v${version}";
tag = "v${finalAttrs.version}";
fetchSubmodules = true;
hash = "sha256-n7lXedICK+sAuSW6hODy+TngAZpDIObWDhTtOjiTXgc=";
};
moduleSet = import ./modules.nix {
inherit fetchFromGitHub rPackages;
jasp-src = src;
jasp-version = version;
};
inherit (moduleSet) jaspBase modules;
# Merges ${R}/lib/R with all used R packages (even propagated ones)
customREnv = buildEnv {
name = "jasp-${version}-env";
paths = [
"${R}/lib/R"
rPackages.RInside
jaspBase # Should already be propagated from modules, but include it again, just in case
]
++ lib.attrValues modules;
};
moduleLibs = linkFarm "jasp-${version}-module-libs" (
lib.mapAttrsToList (name: drv: {
name = name;
path = "${drv}/library";
}) modules
);
in
stdenv.mkDerivation {
pname = "jasp-desktop";
inherit version src;
patches = [
./link-boost-dynamically.patch
./disable-module-install-logic.patch # don't try to install modules via cmake
@@ -74,7 +44,7 @@ stdenv.mkDerivation {
(lib.cmakeFeature "GITHUB_PAT_DEF" "dummy")
(lib.cmakeBool "LINUX_LOCAL_BUILD" false)
(lib.cmakeBool "INSTALL_R_MODULES" false)
(lib.cmakeFeature "CUSTOM_R_PATH" "${customREnv}")
(lib.cmakeFeature "CUSTOM_R_PATH" "${finalAttrs.passthru.customREnv}")
];
nativeBuildInputs = [
@@ -85,8 +55,8 @@ stdenv.mkDerivation {
];
buildInputs = [
finalAttrs.passthru.customREnv
boost
customREnv
freexl
libarchive
librdata
@@ -109,12 +79,37 @@ stdenv.mkDerivation {
--replace-fail "Exec=org.jaspstats.JASP" "Exec=JASP"
# symlink modules from the store
ln -s ${moduleLibs} $out/Modules/module_libs
ln -s ${finalAttrs.passthru.moduleLibs} $out/Modules/module_libs
'';
passthru = {
inherit jaspBase modules;
env = customREnv;
inherit
(import ./modules.nix {
inherit fetchFromGitHub rPackages;
jasp-src = finalAttrs.src;
jasp-version = finalAttrs.version;
})
jaspBase
modules
;
# 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.jaspBase # Should already be propagated from modules, but include it again, just in case
]
++ lib.attrValues finalAttrs.passthru.modules;
};
moduleLibs = linkFarm "jasp-desktop-${finalAttrs.version}-module-libs" (
lib.mapAttrsToList (name: drv: {
name = name;
path = "${drv}/library";
}) finalAttrs.passthru.modules
);
};
meta = {
@@ -128,4 +123,4 @@ stdenv.mkDerivation {
# Perhaps the Darwin-specific things could be changed to be the same as Linux
platforms = lib.platforms.linux;
};
}
})