android-studio: Refactor the code & minor improvements
This commit is contained in:
parent
1ee3ad6732
commit
85e46d12b3
@ -31,7 +31,7 @@
|
|||||||
, stdenv
|
, stdenv
|
||||||
, unzip
|
, unzip
|
||||||
, which
|
, which
|
||||||
, writeTextFile
|
, runCommand
|
||||||
, xkeyboard_config
|
, xkeyboard_config
|
||||||
, zlib
|
, zlib
|
||||||
, makeDesktopItem
|
, makeDesktopItem
|
||||||
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
drvName = "android-studio-${channel}-${version}";
|
drvName = "android-studio-${channel}-${version}";
|
||||||
androidStudio = stdenv.mkDerivation rec {
|
androidStudio = stdenv.mkDerivation {
|
||||||
name = drvName;
|
name = drvName;
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
@ -111,20 +111,18 @@ let
|
|||||||
]}" \
|
]}" \
|
||||||
--set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \
|
--set QT_XKB_CONFIG_ROOT "${xkeyboard_config}/share/X11/xkb" \
|
||||||
--set FONTCONFIG_FILE ${fontsConf}
|
--set FONTCONFIG_FILE ${fontsConf}
|
||||||
|
|
||||||
install -Dm644 bin/studio.png $out/share/pixmaps/${drvName}.png
|
|
||||||
ln -s ${desktopItem}/share/applications $out/share/applications
|
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
desktopItem = makeDesktopItem rec {
|
desktopItem = makeDesktopItem {
|
||||||
name = drvName;
|
name = drvName;
|
||||||
exec = pname;
|
exec = pname;
|
||||||
icon = drvName;
|
icon = drvName;
|
||||||
desktopName = "Android Studio";
|
desktopName = "Android Studio (${channel} channel)";
|
||||||
comment = "The official Android IDE";
|
comment = "The official Android IDE";
|
||||||
categories = "Development;IDE;";
|
categories = "Development;IDE;";
|
||||||
};
|
startupNotify = "true";
|
||||||
|
extraEntries="StartupWMClass=jetbrains-studio";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Android Studio downloads prebuilt binaries as part of the SDK. These tools
|
# Android Studio downloads prebuilt binaries as part of the SDK. These tools
|
||||||
@ -134,39 +132,35 @@ let
|
|||||||
name = "${drvName}-fhs-env";
|
name = "${drvName}-fhs-env";
|
||||||
multiPkgs = pkgs: [ pkgs.ncurses5 ];
|
multiPkgs = pkgs: [ pkgs.ncurses5 ];
|
||||||
};
|
};
|
||||||
|
in runCommand
|
||||||
wrapper = writeTextFile {
|
"${drvName}-wrapper"
|
||||||
name = "${drvName}-wrapper";
|
{
|
||||||
# TODO: Rename preview -> beta (and add -stable suffix?):
|
startScript = ''
|
||||||
destination = "/bin/${pname}";
|
|
||||||
executable = true;
|
|
||||||
text = ''
|
|
||||||
#!${bash}/bin/bash
|
#!${bash}/bin/bash
|
||||||
${fhsEnv}/bin/${drvName}-fhs-env ${androidStudio}/bin/studio.sh
|
${fhsEnv}/bin/${drvName}-fhs-env ${androidStudio}/bin/studio.sh
|
||||||
'';
|
'';
|
||||||
};
|
preferLocalBuild = true;
|
||||||
in stdenv.mkDerivation {
|
allowSubstitutes = false;
|
||||||
name = "${drvName}-with-desktop-item";
|
meta = with stdenv.lib; {
|
||||||
|
description = "The Official IDE for Android (${channel} channel)";
|
||||||
buildCommand = ''
|
longDescription = ''
|
||||||
|
Android Studio is the official IDE for Android app development, based on
|
||||||
|
IntelliJ IDEA.
|
||||||
|
'';
|
||||||
|
homepage = if channel == "stable"
|
||||||
|
then https://developer.android.com/studio/index.html
|
||||||
|
else https://developer.android.com/studio/preview/index.html;
|
||||||
|
license = licenses.asl20;
|
||||||
|
platforms = [ "x86_64-linux" ];
|
||||||
|
maintainers = with maintainers; [ primeos ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
''
|
||||||
mkdir -p $out/{bin,share/pixmaps}
|
mkdir -p $out/{bin,share/pixmaps}
|
||||||
ln -s ${wrapper}/bin/${pname} $out/bin/${pname}
|
|
||||||
|
|
||||||
ln -s ${androidStudio}/share/pixmaps/${drvName}.png $out/share/pixmaps/${drvName}.png
|
# TODO: Rename preview -> beta (and add -stable suffix?):
|
||||||
ln -s ${androidStudio}/share/applications $out/share/applications
|
echo -n "$startScript" > $out/bin/${pname}
|
||||||
'';
|
chmod +x $out/bin/${pname}
|
||||||
|
ln -s ${androidStudio}/bin/studio.png $out/share/pixmaps/${drvName}.png
|
||||||
meta = with stdenv.lib; {
|
ln -s ${desktopItem}/share/applications $out/share/applications
|
||||||
description = "The Official IDE for Android (${channel} channel)";
|
''
|
||||||
longDescription = ''
|
|
||||||
Android Studio is the official IDE for Android app development, based on
|
|
||||||
IntelliJ IDEA.
|
|
||||||
'';
|
|
||||||
homepage = if channel == "stable"
|
|
||||||
then https://developer.android.com/studio/index.html
|
|
||||||
else https://developer.android.com/studio/preview/index.html;
|
|
||||||
license = licenses.asl20;
|
|
||||||
platforms = [ "x86_64-linux" ];
|
|
||||||
maintainers = with maintainers; [ primeos ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user