summary refs log tree commit diff
path: root/pkgs/applications/editors
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2018-08-01 19:05:01 +0200
committerMichael Weiss <dev.primeos@gmail.com>2018-08-01 19:47:36 +0200
commit88bfbf6c7d2308b59f1ca69169c8c9853815ae6b (patch)
treef13d42f59bf49b88a80041358e94b1c9a90bc1e5 /pkgs/applications/editors
parentd8b44edd8fda0d03a71d7f3482ec5df11f1c3a2d (diff)
downloadnixlib-88bfbf6c7d2308b59f1ca69169c8c9853815ae6b.tar
nixlib-88bfbf6c7d2308b59f1ca69169c8c9853815ae6b.tar.gz
nixlib-88bfbf6c7d2308b59f1ca69169c8c9853815ae6b.tar.bz2
nixlib-88bfbf6c7d2308b59f1ca69169c8c9853815ae6b.tar.lz
nixlib-88bfbf6c7d2308b59f1ca69169c8c9853815ae6b.tar.xz
nixlib-88bfbf6c7d2308b59f1ca69169c8c9853815ae6b.tar.zst
nixlib-88bfbf6c7d2308b59f1ca69169c8c9853815ae6b.zip
android-studio-preview: Print a deprecation warning
Hope this is ok... :)
Diffstat (limited to 'pkgs/applications/editors')
-rw-r--r--pkgs/applications/editors/android-studio/common.nix16
-rw-r--r--pkgs/applications/editors/android-studio/default.nix8
2 files changed, 20 insertions, 4 deletions
diff --git a/pkgs/applications/editors/android-studio/common.nix b/pkgs/applications/editors/android-studio/common.nix
index cd031ce5ac8c..c980999dc6ba 100644
--- a/pkgs/applications/editors/android-studio/common.nix
+++ b/pkgs/applications/editors/android-studio/common.nix
@@ -1,4 +1,4 @@
-{ channel, pname, version, build, sha256Hash }:
+{ channel, pname, version, build, sha256Hash, deprecated ? false }:
 
 { bash
 , buildFHSUserEnv
@@ -37,6 +37,18 @@
 }:
 
 let
+  # TODO: This is a bit stupid to be honest...
+  # The problem is that we have to make sure this is only executed if the
+  # derivation is actually build to avoid always printing this warning (e.g.
+  # "nix-env -qaP"). Since this will always evaluate to "" it won't actually
+  # change the derivation (only generate a side-effect) but we have to make
+  # sure this expression is evaluated lazily!
+  printDeprecationWarning = if deprecated then (builtins.trace ''
+    android-studio-preview and androidStudioPackages.preview are old aliases
+    and will be dropped at some point, please use androidStudioPackages.beta
+    instead (corresponds to the correct channel name).''
+    "")
+    else "";
   drvName = "android-studio-${channel}-${version}";
   androidStudio = stdenv.mkDerivation {
     name = drvName;
@@ -130,7 +142,7 @@ in
     text = ''
       #!${bash}/bin/bash
       ${fhsEnv}/bin/${drvName}-fhs-env ${androidStudio}/bin/studio.sh
-    '';
+    '' + printDeprecationWarning;
   } // {
     meta = with stdenv.lib; {
       description = "The Official IDE for Android (${channel} channel)";
diff --git a/pkgs/applications/editors/android-studio/default.nix b/pkgs/applications/editors/android-studio/default.nix
index b60687c50bac..af58611bddf4 100644
--- a/pkgs/applications/editors/android-studio/default.nix
+++ b/pkgs/applications/editors/android-studio/default.nix
@@ -23,8 +23,12 @@ let
     sha256Hash = "0r93yzw87cgzz60p60gknij5vaqmv1a1kyd4cr9gx8cbxw46lhwh";
   };
 in rec {
-  # Old alias
-  preview = beta;
+  # TODO: Drop old alias after 18.09
+  preview = mkStudio (betaVersion // {
+    channel = "beta";
+    pname = "android-studio-preview";
+    deprecated = true;
+  });
 
   # Attributes are named by their corresponding release channels