summary refs log tree commit diff
path: root/pkgs/applications/editors/jetbrains
diff options
context:
space:
mode:
authorArnout Engelen <arnout@bzzt.net>2021-07-03 09:20:31 +0200
committerArnout Engelen <arnout@bzzt.net>2021-07-05 10:44:05 +0200
commitafef449235110366886431e27ade5c385d439307 (patch)
treeedeff617225af881e2ab12b276869d4e7c3b96c7 /pkgs/applications/editors/jetbrains
parentd8079260a3028ae3221d7a5467443ee3a9edd2b8 (diff)
downloadnixpkgs-afef449235110366886431e27ade5c385d439307.tar
nixpkgs-afef449235110366886431e27ade5c385d439307.tar.gz
nixpkgs-afef449235110366886431e27ade5c385d439307.tar.bz2
nixpkgs-afef449235110366886431e27ade5c385d439307.tar.lz
nixpkgs-afef449235110366886431e27ade5c385d439307.tar.xz
nixpkgs-afef449235110366886431e27ade5c385d439307.tar.zst
nixpkgs-afef449235110366886431e27ade5c385d439307.zip
jetbrains: update script improvements
Fix some warnings and allow updating only the free modules.
Diffstat (limited to 'pkgs/applications/editors/jetbrains')
-rw-r--r--pkgs/applications/editors/jetbrains/common.nix6
-rw-r--r--pkgs/applications/editors/jetbrains/default.nix4
-rwxr-xr-xpkgs/applications/editors/jetbrains/update.pl6
3 files changed, 12 insertions, 4 deletions
diff --git a/pkgs/applications/editors/jetbrains/common.nix b/pkgs/applications/editors/jetbrains/common.nix
index dcbaa136795..2e244364dc7 100644
--- a/pkgs/applications/editors/jetbrains/common.nix
+++ b/pkgs/applications/editors/jetbrains/common.nix
@@ -38,7 +38,7 @@ with stdenv; lib.makeOverridable mkDerivation rec {
 
   nativeBuildInputs = [ makeWrapper patchelf unzip ];
 
-  patchPhase = lib.optionalString (!stdenv.isDarwin) ''
+  postPatch = lib.optionalString (!stdenv.isDarwin) ''
       get_file_size() {
         local fname="$1"
         echo $(ls -l $fname | cut -d ' ' -f5)
@@ -64,6 +64,8 @@ with stdenv; lib.makeOverridable mkDerivation rec {
   '';
 
   installPhase = ''
+    runHook preInstall
+
     mkdir -p $out/{bin,$name,share/pixmaps,libexec/${name}}
     cp -a . $out/$name
     ln -s $out/$name/bin/${loName}.png $out/share/pixmaps/${mainProgram}.png
@@ -86,6 +88,8 @@ with stdenv; lib.makeOverridable mkDerivation rec {
       --set ${hiName}_VM_OPTIONS ${vmoptsFile}
 
     ln -s "$item/share/applications" $out/share
+
+    runHook postInstall
   '';
 
 } // lib.optionalAttrs (!(meta.license.free or true)) {
diff --git a/pkgs/applications/editors/jetbrains/default.nix b/pkgs/applications/editors/jetbrains/default.nix
index 38ea3054a60..f89ff39a7e5 100644
--- a/pkgs/applications/editors/jetbrains/default.nix
+++ b/pkgs/applications/editors/jetbrains/default.nix
@@ -193,7 +193,7 @@ let
         platforms = platforms.linux;
       };
     }).overrideAttrs (attrs: {
-      patchPhase = lib.optionalString (!stdenv.isDarwin) (attrs.patchPhase + ''
+      postPatch = lib.optionalString (!stdenv.isDarwin) (attrs.postPatch + ''
         rm -rf lib/ReSharperHost/linux-x64/dotnet
         mkdir -p lib/ReSharperHost/linux-x64/dotnet/
         ln -s ${dotnet-sdk_5}/bin/dotnet lib/ReSharperHost/linux-x64/dotnet/dotnet
@@ -229,7 +229,7 @@ let
         platforms = platforms.linux;
       };
     }).overrideAttrs (attrs: {
-      patchPhase = (attrs.patchPhase or "") + optionalString (stdenv.isLinux) ''
+      postPatch = (attrs.postPatch or "") + optionalString (stdenv.isLinux) ''
         # Webstorm tries to use bundled jre if available.
         # Lets prevent this for the moment
         rm -r jbr
diff --git a/pkgs/applications/editors/jetbrains/update.pl b/pkgs/applications/editors/jetbrains/update.pl
index cd3d2193a28..65f7d0ae7aa 100755
--- a/pkgs/applications/editors/jetbrains/update.pl
+++ b/pkgs/applications/editors/jetbrains/update.pl
@@ -6,6 +6,8 @@ use List::Util qw(reduce);
 use File::Slurp;
 use LWP::Simple;
 
+my $only_free = grep { $_ eq "--only-free" } @ARGV;
+
 sub semantic_less {
   my ($a, $b) = @_;
   $a =~ s/\b(\d+)\b/sprintf("%010s", $1)/eg;
@@ -55,13 +57,15 @@ sub update_nix_block {
       die "no version in $block" unless $version;
       if ($version eq $latest_versions{$channel}) {
         print("$channel is up to date at $version\n");
+      } elsif ($only_free && $block =~ /licenses\.unfree/) {
+        print("$channel is unfree, skipping\n");
       } else {
         print("updating $channel: $version -> $latest_versions{$channel}\n");
         my ($url) = $block =~ /url\s*=\s*"([^"]+)"/;
         # try to interpret some nix
         my ($name) = $block =~ /name\s*=\s*"([^"]+)"/;
         $name =~ s/\$\{version\}/$latest_versions{$channel}/;
-        # Some url paattern contain variables more than once
+        # Some url pattern contain variables more than once
         $url =~ s/\$\{name\}/$name/g;
         $url =~ s/\$\{version\}/$latest_versions{$channel}/g;
         die "$url still has some interpolation" if $url =~ /\$/;