From c3040d2675295fbd4a8673f28dd00fbbca640565 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Mon, 19 Jan 2026 23:50:25 +0100 Subject: [PATCH] jasp-desktop: refactor to use finalAttrs --- pkgs/by-name/ja/jasp-desktop/package.nix | 73 +++++++++++------------- 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/pkgs/by-name/ja/jasp-desktop/package.nix b/pkgs/by-name/ja/jasp-desktop/package.nix index b2f666742cc4..12a859281212 100644 --- a/pkgs/by-name/ja/jasp-desktop/package.nix +++ b/pkgs/by-name/ja/jasp-desktop/package.nix @@ -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; }; -} +})