From 3383216f30cf11c93b49d507105b442aaae85af4 Mon Sep 17 00:00:00 2001 From: Jean-Pierre PRUNARET Date: Sat, 4 Mar 2017 14:41:21 +0100 Subject: [PATCH] ajout expression pour idea14 ultimate --- idea/common.nix | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ idea/default.nix | 57 +++++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 idea/common.nix create mode 100644 idea/default.nix diff --git a/idea/common.nix b/idea/common.nix new file mode 100644 index 0000000..839f537 --- /dev/null +++ b/idea/common.nix @@ -0,0 +1,74 @@ +{ stdenv, fetchurl, makeDesktopItem, makeWrapper, patchelf, p7zip +, coreutils, gnugrep, which, git, python, unzip }: + +{ name, product, version, src, wmClass, jdk, meta } @ attrs: + +with stdenv.lib; + +let loName = toLower product; + hiName = toUpper product; + execName = concatStringsSep "-" (init (splitString "-" name)); +in + +with stdenv; lib.makeOverridable mkDerivation rec { + inherit name src meta; + desktopItem = makeDesktopItem { + name = execName; + exec = execName; + comment = lib.replaceChars ["\n"] [" "] meta.longDescription; + desktopName = product; + genericName = meta.description; + categories = "Application;Development;"; + icon = execName; + extraEntries = '' + StartupWMClass=${wmClass} + ''; + }; + + buildInputs = [ makeWrapper patchelf p7zip unzip ]; + + patchPhase = '' + get_file_size() { + local fname="$1" + echo $(ls -l $fname | cut -d ' ' -f5) + } + + munge_size_hack() { + local fname="$1" + local size="$2" + strip $fname + truncate --size=$size $fname + } + + interpreter=$(echo ${stdenv.glibc.out}/lib/ld-linux*.so.2) + if [ "${stdenv.system}" == "x86_64-linux" ]; then + target_size=$(get_file_size bin/fsnotifier64) + patchelf --set-interpreter "$interpreter" bin/fsnotifier64 + munge_size_hack bin/fsnotifier64 $target_size + else + target_size=$(get_file_size bin/fsnotifier) + patchelf --set-interpreter "$interpreter" bin/fsnotifier + munge_size_hack bin/fsnotifier $target_size + fi + ''; + + installPhase = '' + mkdir -p $out/{bin,$name,share/pixmaps,libexec/${name}} + cp -a . $out/$name + ln -s $out/$name/bin/${loName}.png $out/share/pixmaps/${execName}.png + mv bin/fsnotifier* $out/libexec/${name}/. + + jdk=${jdk.home} + item=${desktopItem} + + makeWrapper "$out/$name/bin/${loName}.sh" "$out/bin/${execName}" \ + --prefix PATH : "$out/libexec/${name}:${stdenv.lib.makeBinPath [ jdk coreutils gnugrep which git ]}" \ + --set JDK_HOME "$jdk" \ + --set ${hiName}_JDK "$jdk" \ + --set ANDROID_JAVA_HOME "$jdk" \ + --set JAVA_HOME "$jdk" + + ln -s "$item/share/applications" $out/share + ''; + +} diff --git a/idea/default.nix b/idea/default.nix new file mode 100644 index 0000000..cebf5ef --- /dev/null +++ b/idea/default.nix @@ -0,0 +1,57 @@ +{ nixpkgs ? import {} +, stdenv ? nixpkgs.stdenv +#, callPackage +#, fetchurl +#, makeDesktopItem +#, makeWrapper +#, patchelf + +#, coreutils +#, gnugrep +#, which +#, git +#, python +#, unzip +#, p7zip + +#, androidsdk, jdk +}: + +with nixpkgs; +assert stdenv.isLinux; + +let + mkIdeaProduct = callPackage ./common.nix { }; + + buildIdea = { name, version, src, license, description, wmClass }: + (mkIdeaProduct rec { + inherit name version src wmClass jdk; + product = "IDEA"; + meta = with stdenv.lib; { + homepage = "https://www.jetbrains.com/idea/"; + inherit description license; + longDescription = '' + IDE for Java SE, Groovy & Scala development Powerful + environment for building Google Android apps Integration + with JUnit, TestNG, popular SCMs, Ant & Maven. + ''; + maintainers = with maintainers; [ edwtjo ]; + platforms = platforms.linux; + }; + }); +in + +{ + idea14-ultimate = buildIdea rec { + name = "idea-ultimate-${version}"; + version = "14.1.7"; + description = "Integrated Development Environment (IDE) by Jetbrains, requires paid license"; + license = stdenv.lib.licenses.bsd3; + #license = stdenv.lib.licenses.unfree; + src = fetchurl { + url = "https://download.jetbrains.com/idea/ideaIU-${version}.tar.gz"; + sha256 = "1hhga1i2zbsipgq283gn19kv9n94inhr1bxh2yx19gz7yr4r49d2"; + }; + wmClass = "jetbrains-idea"; + }; +}