Skip to content

Commit

Permalink
rstudio: use finalAttrs and move dictionary logic
Browse files Browse the repository at this point in the history
  • Loading branch information
TomaSajt committed Nov 27, 2024
1 parent 1da1c18 commit 0c354f0
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions pkgs/applications/editors/rstudio/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,31 @@ let
hash = "sha256-lZnZvioztbBWWa6H177X6rRrrgACx2gMjVFDgNup93g=";
};

hunspellDictionaries = lib.filter lib.isDerivation (lib.unique (lib.attrValues hunspellDicts));

# These dicts contain identically-named dict files, so we only keep the
# -large versions in case of clashes
largeDicts = lib.filter (d: lib.hasInfix "-large-wordlist" d.name) hunspellDictionaries;

otherDicts = lib.filter (
d: !(lib.hasAttr "dictFileName" d && lib.elem d.dictFileName (map (d: d.dictFileName) largeDicts))
) hunspellDictionaries;

dictionaries = largeDicts ++ otherDicts;
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "RStudio";
version = "2024.04.2+764";

RSTUDIO_VERSION_MAJOR = lib.versions.major version;
RSTUDIO_VERSION_MINOR = lib.versions.minor version;
RSTUDIO_VERSION_PATCH = lib.versions.patch version;
RSTUDIO_VERSION_SUFFIX = "+" + toString (lib.tail (lib.splitString "+" version));
RSTUDIO_VERSION_MAJOR = lib.versions.major finalAttrs.version;
RSTUDIO_VERSION_MINOR = lib.versions.minor finalAttrs.version;
RSTUDIO_VERSION_PATCH = lib.versions.patch finalAttrs.version;
RSTUDIO_VERSION_SUFFIX = "+" + toString (lib.tail (lib.splitString "+" finalAttrs.version));

src = fetchFromGitHub {
owner = "rstudio";
repo = "rstudio";
rev = "v" + version;
rev = "v${finalAttrs.version}";
hash = "sha256-j258eW1MYQrB6kkpjyolXdNuwQ3zSWv9so4q0QLsZuw=";
};

Expand Down Expand Up @@ -149,15 +160,6 @@ stdenv.mkDerivation rec {
./dont-assume-pandoc-in-quarto.patch
];

hunspellDictionaries = lib.filter lib.isDerivation (lib.unique (lib.attrValues hunspellDicts));
# These dicts contain identically-named dict files, so we only keep the
# -large versions in case of clashes
largeDicts = lib.filter (d: lib.hasInfix "-large-wordlist" d.name) hunspellDictionaries;
otherDicts = lib.filter (
d: !(lib.hasAttr "dictFileName" d && lib.elem d.dictFileName (map (d: d.dictFileName) largeDicts))
) hunspellDictionaries;
dictionaries = largeDicts ++ otherDicts;

preConfigure = ''
# set up node_modules directory inside quarto so that panmirror can be built
mkdir src/gwt/lib/quarto
Expand Down Expand Up @@ -223,7 +225,7 @@ stdenv.mkDerivation rec {
icon = "rstudio";
desktopName = "RStudio";
genericName = "IDE";
comment = meta.description;
comment = finalAttrs.meta.description;
categories = [ "Development" ];
mimeTypes = [
"text/x-r-source"
Expand Down Expand Up @@ -270,4 +272,4 @@ stdenv.mkDerivation rec {
inherit (nixosTests) rstudio-server;
};
};
}
})

0 comments on commit 0c354f0

Please sign in to comment.