diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2024-04-04 15:33:55 +0200 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2024-04-05 09:23:05 +0200 |
commit | e2d93cb47edf4bd741aee59a8b2ba4a5de158428 (patch) | |
tree | e3f2e83f7c542dc20b270270ae999ed990f1ad9a | |
parent | ce7b7e7e8ae70882aad8bae4fc7e4185e27b1341 (diff) |
sublime4,sublime-merge: format with nixpkgs-fmt
4 files changed, 215 insertions, 80 deletions
diff --git a/pkgs/applications/editors/sublime/4/common.nix b/pkgs/applications/editors/sublime/4/common.nix index e71185f3f010b..0fdf8f642e0ea 100644 --- a/pkgs/applications/editors/sublime/4/common.nix +++ b/pkgs/applications/editors/sublime/4/common.nix @@ -1,19 +1,53 @@ -{ buildVersion, aarch64sha256, x64sha256, dev ? false }: +{ + buildVersion, + dev ? false, + aarch64sha256, + x64sha256, +}: -{ fetchurl, stdenv, lib, xorg, glib, libglvnd, glibcLocales, gtk3, cairo, pango, makeWrapper, wrapGAppsHook -, writeShellScript, common-updater-scripts, curl -, openssl_1_1, bzip2, bash, unzip, zip -, sqlite +{ + fetchurl, + stdenv, + lib, + xorg, + glib, + libglvnd, + glibcLocales, + gtk3, + cairo, + pango, + makeWrapper, + wrapGAppsHook, + writeShellScript, + common-updater-scripts, + curl, + openssl_1_1, + bzip2, + bash, + unzip, + zip, + sqlite, }: let pnameBase = "sublimetext4"; packageAttribute = "sublime4${lib.optionalString dev "-dev"}"; - binaries = [ "sublime_text" "plugin_host-3.3" "plugin_host-3.8" crashHandlerBinary ]; + binaries = [ + "sublime_text" + "plugin_host-3.3" + "plugin_host-3.8" + crashHandlerBinary + ]; primaryBinary = "sublime_text"; - primaryBinaryAliases = [ "subl" "sublime" "sublime4" ]; - crashHandlerBinary = if lib.versionAtLeast buildVersion "4153" then "crash_handler" else "crash_reporter"; - downloadUrl = arch: "https://download.sublimetext.com/sublime_text_build_${buildVersion}_${arch}.tar.xz"; + primaryBinaryAliases = [ + "subl" + "sublime" + "sublime4" + ]; + crashHandlerBinary = + if lib.versionAtLeast buildVersion "4153" then "crash_handler" else "crash_reporter"; + downloadUrl = + arch: "https://download.sublimetext.com/sublime_text_build_${buildVersion}_${arch}.tar.xz"; versionUrl = "https://download.sublimetext.com/latest/${if dev then "dev" else "stable"}"; versionFile = builtins.toString ./packages.nix; @@ -30,7 +64,8 @@ let ] ++ lib.optionals (lib.versionAtLeast buildVersion "4145") [ sqlite ]; -in let +in +let binaryPackage = stdenv.mkDerivation rec { pname = "${pnameBase}-bin"; version = buildVersion; @@ -39,8 +74,19 @@ in let dontStrip = true; dontPatchELF = true; - buildInputs = [ glib gtk3 ]; # for GSETTINGS_SCHEMAS_PATH - nativeBuildInputs = [ zip unzip makeWrapper wrapGAppsHook ]; + + buildInputs = [ + glib + # for GSETTINGS_SCHEMAS_PATH + gtk3 + ]; + + nativeBuildInputs = [ + zip + unzip + makeWrapper + wrapGAppsHook + ]; # make exec.py in Default.sublime-package use own bash with an LD_PRELOAD instead of "/bin/bash" patchPhase = '' @@ -63,7 +109,7 @@ in let buildPhase = '' runHook preBuild - for binary in ${ builtins.concatStringsSep " " binaries }; do + for binary in ${builtins.concatStringsSep " " binaries}; do patchelf \ --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${lib.makeLibraryPath neededLibraries}:${stdenv.cc.cc.lib}/lib${lib.optionalString stdenv.is64bit "64"} \ @@ -116,7 +162,8 @@ in let }; }; }; -in stdenv.mkDerivation (rec { +in +stdenv.mkDerivation (rec { pname = pnameBase; version = buildVersion; @@ -124,27 +171,39 @@ in stdenv.mkDerivation (rec { ${primaryBinary} = binaryPackage; - nativeBuildInputs = [ makeWrapper ]; - - installPhase = '' - mkdir -p "$out/bin" - makeWrapper "''$${primaryBinary}/${primaryBinary}" "$out/bin/${primaryBinary}" - '' + builtins.concatStringsSep "" (map (binaryAlias: "ln -s $out/bin/${primaryBinary} $out/bin/${binaryAlias}\n") primaryBinaryAliases) + '' - mkdir -p "$out/share/applications" - substitute "''$${primaryBinary}/${primaryBinary}.desktop" "$out/share/applications/${primaryBinary}.desktop" --replace "/opt/${primaryBinary}/${primaryBinary}" "${primaryBinary}" - for directory in ''$${primaryBinary}/Icon/*; do - size=$(basename $directory) - mkdir -p "$out/share/icons/hicolor/$size/apps" - ln -s ''$${primaryBinary}/Icon/$size/* $out/share/icons/hicolor/$size/apps - done - ''; + nativeBuildInputs = [ + makeWrapper + ]; + + installPhase = + '' + mkdir -p "$out/bin" + makeWrapper "''$${primaryBinary}/${primaryBinary}" "$out/bin/${primaryBinary}" + '' + + builtins.concatStringsSep "" ( + map (binaryAlias: "ln -s $out/bin/${primaryBinary} $out/bin/${binaryAlias}\n") primaryBinaryAliases + ) + + '' + mkdir -p "$out/share/applications" + substitute "''$${primaryBinary}/${primaryBinary}.desktop" "$out/share/applications/${primaryBinary}.desktop" --replace "/opt/${primaryBinary}/${primaryBinary}" "${primaryBinary}" + for directory in ''$${primaryBinary}/Icon/*; do + size=$(basename $directory) + mkdir -p "$out/share/icons/hicolor/$size/apps" + ln -s ''$${primaryBinary}/Icon/$size/* $out/share/icons/hicolor/$size/apps + done + ''; passthru = { updateScript = let script = writeShellScript "${packageAttribute}-update-script" '' set -o errexit - PATH=${lib.makeBinPath [ common-updater-scripts curl ]} + PATH=${ + lib.makeBinPath [ + common-updater-scripts + curl + ] + } versionFile=$1 latestVersion=$(curl -s "${versionUrl}") @@ -161,15 +220,27 @@ in stdenv.mkDerivation (rec { update-source-version "${packageAttribute}.${primaryBinary}" "$latestVersion" --file="$versionFile" --version-key=buildVersion --source-key="sources.$platform" done ''; - in [ script versionFile ]; + in + [ + script + versionFile + ]; }; meta = with lib; { description = "Sophisticated text editor for code, markup and prose"; homepage = "https://www.sublimetext.com/"; - maintainers = with maintainers; [ jtojnar wmertens demin-dmitriy zimbatm ]; + maintainers = with maintainers; [ + jtojnar + wmertens + demin-dmitriy + zimbatm + ]; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; license = licenses.unfree; - platforms = [ "aarch64-linux" "x86_64-linux" ]; + platforms = [ + "aarch64-linux" + "x86_64-linux" + ]; }; }) diff --git a/pkgs/applications/editors/sublime/4/packages.nix b/pkgs/applications/editors/sublime/4/packages.nix index d583467ad832c..b6ef934f44534 100644 --- a/pkgs/applications/editors/sublime/4/packages.nix +++ b/pkgs/applications/editors/sublime/4/packages.nix @@ -3,17 +3,17 @@ let common = opts: callPackage (import ./common.nix opts); in - { - sublime4 = common { - buildVersion = "4169"; - x64sha256 = "jk9wKC0QgfhiHDYUcnDhsmgJsBPOUmCkyvQeI54IJJ4="; - aarch64sha256 = "/W/xGbE+8gGu1zNh6lERZrfG9Dh9QUGkYiqTzp216JI="; - } {}; +{ + sublime4 = common { + buildVersion = "4169"; + x64sha256 = "jk9wKC0QgfhiHDYUcnDhsmgJsBPOUmCkyvQeI54IJJ4="; + aarch64sha256 = "/W/xGbE+8gGu1zNh6lERZrfG9Dh9QUGkYiqTzp216JI="; + } { }; - sublime4-dev = common { - buildVersion = "4168"; - dev = true; - x64sha256 = "KfW1Mh78CUBTmthHQd1s15a7GrmssSnWZ1RgaarJeag="; - aarch64sha256 = "qJ9oix1kwWN+TUb5/WSKyHcHzB+Q87XolMOhmqx1OFc="; - } {}; - } + sublime4-dev = common { + buildVersion = "4168"; + dev = true; + x64sha256 = "KfW1Mh78CUBTmthHQd1s15a7GrmssSnWZ1RgaarJeag="; + aarch64sha256 = "qJ9oix1kwWN+TUb5/WSKyHcHzB+Q87XolMOhmqx1OFc="; + } { }; +} diff --git a/pkgs/applications/version-management/sublime-merge/common.nix b/pkgs/applications/version-management/sublime-merge/common.nix index c3c7964b52a35..4773af014ae48 100644 --- a/pkgs/applications/version-management/sublime-merge/common.nix +++ b/pkgs/applications/version-management/sublime-merge/common.nix @@ -1,18 +1,49 @@ -{ buildVersion, aarch64sha256, x64sha256, dev ? false }: +{ + buildVersion, + dev ? false, + aarch64sha256, + x64sha256, +}: -{ fetchurl, lib, stdenv, xorg, glib, libGL, glibcLocales, gtk3, cairo, pango, libredirect, makeWrapper, wrapGAppsHook -, pkexecPath ? "/run/wrappers/bin/pkexec" -, writeShellScript, common-updater-scripts, curl, gnugrep, coreutils +{ + fetchurl, + lib, + stdenv, + xorg, + glib, + libGL, + glibcLocales, + gtk3, + cairo, + pango, + libredirect, + makeWrapper, + wrapGAppsHook, + pkexecPath ? "/run/wrappers/bin/pkexec", + writeShellScript, + common-updater-scripts, + curl, + gnugrep, + coreutils, }: let pnameBase = "sublime-merge"; packageAttribute = "sublime-merge${lib.optionalString dev "-dev"}"; - binaries = [ "sublime_merge" crashHandlerBinary "git-credential-sublime" "ssh-askpass-sublime" ]; + binaries = [ + "sublime_merge" + crashHandlerBinary + "git-credential-sublime" + "ssh-askpass-sublime" + ]; primaryBinary = "sublime_merge"; - primaryBinaryAliases = [ "smerge" ]; - crashHandlerBinary = if lib.versionAtLeast buildVersion "2086" then "crash_handler" else "crash_reporter"; - downloadUrl = arch: "https://download.sublimetext.com/sublime_merge_build_${buildVersion}_${arch}.tar.xz"; + primaryBinaryAliases = [ + "smerge" + ]; + crashHandlerBinary = + if lib.versionAtLeast buildVersion "2086" then "crash_handler" else "crash_reporter"; + downloadUrl = + arch: "https://download.sublimetext.com/sublime_merge_build_${buildVersion}_${arch}.tar.xz"; versionUrl = "https://www.sublimemerge.com/${if dev then "dev" else "download"}"; versionFile = builtins.toString ./default.nix; @@ -25,8 +56,12 @@ let curl ]; - redirects = [ "/usr/bin/pkexec=${pkexecPath}" "/bin/true=${coreutils}/bin/true" ]; -in let + redirects = [ + "/usr/bin/pkexec=${pkexecPath}" + "/bin/true=${coreutils}/bin/true" + ]; +in +let binaryPackage = stdenv.mkDerivation rec { pname = "${pnameBase}-bin"; version = buildVersion; @@ -35,13 +70,20 @@ in let dontStrip = true; dontPatchELF = true; - buildInputs = [ glib gtk3 ]; # for GSETTINGS_SCHEMAS_PATH - nativeBuildInputs = [ makeWrapper wrapGAppsHook ]; + buildInputs = [ + glib + # for GSETTINGS_SCHEMAS_PATH + gtk3 + ]; + nativeBuildInputs = [ + makeWrapper + wrapGAppsHook + ]; buildPhase = '' runHook preBuild - for binary in ${ builtins.concatStringsSep " " binaries }; do + for binary in ${builtins.concatStringsSep " " binaries}; do patchelf \ --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-rpath ${lib.makeLibraryPath neededLibraries}:${libGL}/lib:${stdenv.cc.cc.lib}/lib${lib.optionalString stdenv.is64bit "64"} \ @@ -96,7 +138,8 @@ in let }; }; }; -in stdenv.mkDerivation (rec { +in +stdenv.mkDerivation (rec { pname = pnameBase; version = buildVersion; @@ -104,27 +147,40 @@ in stdenv.mkDerivation (rec { ${primaryBinary} = binaryPackage; - nativeBuildInputs = [ makeWrapper ]; - - installPhase = '' - mkdir -p "$out/bin" - makeWrapper "''$${primaryBinary}/${primaryBinary}" "$out/bin/${primaryBinary}" - '' + builtins.concatStringsSep "" (map (binaryAlias: "ln -s $out/bin/${primaryBinary} $out/bin/${binaryAlias}\n") primaryBinaryAliases) + '' - mkdir -p "$out/share/applications" - substitute "''$${primaryBinary}/${primaryBinary}.desktop" "$out/share/applications/${primaryBinary}.desktop" --replace "/opt/${primaryBinary}/${primaryBinary}" "${primaryBinary}" - for directory in ''$${primaryBinary}/Icon/*; do - size=$(basename $directory) - mkdir -p "$out/share/icons/hicolor/$size/apps" - ln -s ''$${primaryBinary}/Icon/$size/* $out/share/icons/hicolor/$size/apps - done - ''; + nativeBuildInputs = [ + makeWrapper + ]; + + installPhase = + '' + mkdir -p "$out/bin" + makeWrapper "''$${primaryBinary}/${primaryBinary}" "$out/bin/${primaryBinary}" + '' + + builtins.concatStringsSep "" ( + map (binaryAlias: "ln -s $out/bin/${primaryBinary} $out/bin/${binaryAlias}\n") primaryBinaryAliases + ) + + '' + mkdir -p "$out/share/applications" + substitute "''$${primaryBinary}/${primaryBinary}.desktop" "$out/share/applications/${primaryBinary}.desktop" --replace "/opt/${primaryBinary}/${primaryBinary}" "${primaryBinary}" + for directory in ''$${primaryBinary}/Icon/*; do + size=$(basename $directory) + mkdir -p "$out/share/icons/hicolor/$size/apps" + ln -s ''$${primaryBinary}/Icon/$size/* $out/share/icons/hicolor/$size/apps + done + ''; passthru = { updateScript = let script = writeShellScript "${packageAttribute}-update-script" '' set -o errexit - PATH=${lib.makeBinPath [ common-updater-scripts curl gnugrep ]} + PATH=${ + lib.makeBinPath [ + common-updater-scripts + curl + gnugrep + ] + } versionFile=$1 latestVersion=$(curl -s ${versionUrl} | grep -Po '(?<=<p class="latest"><i>Version:</i> Build )([0-9]+)') @@ -141,7 +197,11 @@ in stdenv.mkDerivation (rec { update-source-version "${packageAttribute}.${primaryBinary}" "$latestVersion" --file="$versionFile" --version-key=buildVersion --source-key="sources.$platform" done ''; - in [ script versionFile ]; + in + [ + script + versionFile + ]; }; meta = with lib; { @@ -150,6 +210,9 @@ in stdenv.mkDerivation (rec { maintainers = with maintainers; [ zookatron ]; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; license = licenses.unfree; - platforms = [ "aarch64-linux" "x86_64-linux" ]; + platforms = [ + "aarch64-linux" + "x86_64-linux" + ]; }; }) diff --git a/pkgs/applications/version-management/sublime-merge/default.nix b/pkgs/applications/version-management/sublime-merge/default.nix index 068e9cca20aa6..6a1cc1e5575e1 100644 --- a/pkgs/applications/version-management/sublime-merge/default.nix +++ b/pkgs/applications/version-management/sublime-merge/default.nix @@ -2,17 +2,18 @@ let common = opts: callPackage (import ./common.nix opts); -in { +in +{ sublime-merge = common { buildVersion = "2091"; aarch64sha256 = "dkPKuuzQQtL3eZlaAPeL7e2p5PCxroFRSp6Rw5wHODc="; x64sha256 = "T5g6gHgl9xGytEOsh3VuB08IrbDvMu24o/1edCGmfd4="; - } {}; + } { }; sublime-merge-dev = common { buildVersion = "2092"; + dev = true; aarch64sha256 = "3QMDynXMVB4QVtM8EPbZ8I4m+5sEjzs8XN+jEoMaktM="; x64sha256 = "S9E+wRvO41Eq+PLA/J+sjBIAn6yz715Wg9bKRW2Eobg="; - dev = true; - } {}; + } { }; } |