Appimage/ru: Difference between revisions

Unabomberlive (talk | contribs)
Created page with "== Как файлы AppImage упаковываются для Nixos =="
Sk7Str1p3 (talk | contribs)
Add translation.
 
(20 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<div lang="en" dir="ltr" class="mw-content-ltr">
[https://appimage.org/ AppImage] - тип монолитных пакетов для приложений Linux. Содержит все зависимости приложения в одном файле, состоящем из исполняемого файла и встроенной файловой системы.
[https://appimage.org/ AppImage] is a monolithic packaging format for linux applications. It contains all dependencies in one file that is composed of an executable with a tacked on filesystem.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Usage"></span>
On most distros, all one has to do is download the <code>.AppImage</code> file, make it executable <code>chmod +x $AppImage</code>, and execute it. This doesn't work in NixOS out of the box though, as AppImage files usually (if not always) depend on certain libraries commonly found on other Linux distributions to exist on certain paths; such as <code>/lib64/ld-linux-x86-64.so.2</code>.
== Использование ==
</div>


<span id="Running_an_AppImage_file_on_NixOS"></span>
<span id="Run"></span>
== Запуск исполняемых файлов AppImage на NixOS ==
=== Запуск ===
 
В большинстве дистрибутивов все, что нужно сделать, это загрузить файл <code>.AppImage</code>, сделать его исполняемым <code>chmod +x $AppImage</code> и выполнить его. Однако это не работает в NixOS «из коробки», поскольку файлы AppImage обычно (если не всегда) зависят от определенных библиотек находящихся в жёстко заданных путях.


<syntaxhighlight lang="shell">
<syntaxhighlight lang="shell">
Line 15: Line 14:
$ appimage-run $AppImageFile
$ appimage-run $AppImageFile
</syntaxhighlight>
</syntaxhighlight>
<span id="Packaging"></span>
=== Создание AppImage ===
См. руководство [https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-appimageTools Nixpkgs manual on wrapping AppImage packages]. Если кратко, AppImage извлекается, а все зависимости добавляются в качестве зависимостей сборки nix. Следующий пример представляет собой производную для программы Quba, которая также распространяется в виде AppImage.
<syntaxhighlight lang="nix">
{
  lib,
  appimageTools,
  fetchurl,
}:
let
  version = "1.4.0";
  pname = "quba";
  name = "${pname}-${version}";
src = fetchurl {
    url = "https://github.com/ZUGFeRD/quba-viewer/releases/download/v${version}/Quba-${version}.AppImage";
    hash = "sha256-EsTF7W1np5qbQQh3pdqsFe32olvGK3AowGWjqHPEfoM=";
  };
appimageContents = appimageTools.extractType1 { inherit name src; };
in
appimageTools.wrapType1 {
  inherit name src;
extraInstallCommands = ''
    mv $out/bin/${name} $out/bin/${pname}
    install -m 444 -D ${appimageContents}/${pname}.desktop -t $out/share/applications
    substituteInPlace $out/share/applications/${pname}.desktop \
      --replace-fail 'Exec=AppRun' 'Exec=${pname}'
    cp -r ${appimageContents}/usr/share/icons $out/share
  '';
meta = {
    description = "Viewer for electronic invoices";
    homepage = "https://github.com/ZUGFeRD/quba-viewer";
    downloadPage = "https://github.com/ZUGFeRD/quba-viewer/releases";
    license = lib.licenses.asl20;
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    maintainers = with lib.maintainers; [ onny ];
    platforms = [ "x86_64-linux" ];
  };
}
</syntaxhighlight>
<span id="Configuration"></span>
== Настройка ==


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Register_AppImage_files_as_a_binary_type_to_binfmt_misc"></span>
== Register AppImage files as a binary type to binfmt_misc ==
== Зарегистрируйте файлы AppImage как исполняемый тип в binfmt_misc ==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Вы можете указать ядру Linux использовать интерпретатор (например, <code>appimage-run</code>) при выполнении определенных двоичных файлов через использование [https://en.wikipedia.org/wiki/Binfmt_misc#External_links binfmt_misc], либо по расширению имени файла, либо по совпадению магических чисел.
You can tell the Linux kernel to use an interpreter (e.g. <code>appimage-run</code>) when executing certain binary files through the use of [https://en.wikipedia.org/wiki/Binfmt_misc#External_links binfmt_misc], either by filename extension or magic number matching. Below NixOS configuration registers AppImage files (ELF files with magic number "AI" + 0x02) to be run with <code>appimage-run</code> as interpreter.
Приведенная ниже конфигурация NixOS регистрирует файлы AppImage (ELF-файлы с магическим числом "AI" + 0x02) для запуска с помощью <code>appimage-run</code> в качестве интерпретатора.
</div>


С [https://nixos.org/manual/nixos/stable/release-notes#sec-release-24.05-new-services NixOS 24.05], имеется опция binfmt:
С [https://nixos.org/manual/nixos/stable/release-notes#sec-release-24.05-new-services NixOS 24.05], имеется опция binfmt:
Line 34: Line 80:


Таким образом файлы AppImage могут вызываться напрямую, как если бы они были обычными программами
Таким образом файлы AppImage могут вызываться напрямую, как если бы они были обычными программами
<span id="How_AppImage_files_are_packaged_by_NixOS"></span>
== Как файлы AppImage упаковываются для Nixos ==
<div lang="en" dir="ltr" class="mw-content-ltr">
See the [https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-appimageTools nixpkgs manual on wrapping AppImage packages]. In short, the AppImage is extracted and any dependencies are added as nix build dependencies.
</div>


[[Category:Software{{#translation:}}]]
[[Category:Software{{#translation:}}]]