Appimage/ja: Difference between revisions
Haruki7049 (talk | contribs) Created page with "Appimage" |
Updating to match new version of source page |
||
| (12 intermediate revisions by 2 users not shown) | |||
| Line 4: | Line 4: | ||
</div> | </div> | ||
< | <span id="Usage"></span> | ||
== 使い方 == | |||
<span id="Run"></span> | |||
=== 実行 === | |||
< | ほとんどのLinuxディストリビューションでは、<code>.AppImage</code>ファイルをダウンロードし、それを実行可能ファイル<code>chmod +x $AppImage</code>にして実行するだけです。ただし、AppImageファイルは通常(常にではないにしても)ハードコードされたパス内の特定のシステムライブラリに依存するため、NixOSではそのままでは機能しません。 | ||
</ | |||
<syntaxhighlight lang="shell"> | <syntaxhighlight lang="shell"> | ||
| Line 16: | Line 16: | ||
$ appimage-run $AppImageFile | $ appimage-run $AppImageFile | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<span id="Packaging"></span> | |||
=== パッケージング === | |||
<div | <div class="mw-translate-fuzzy"> | ||
[https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-appimageTools nixpkgs manual on wrapping AppImage packages]を参照してください。要するに、AppImageが抽出され、依存関係がnixビルド依存関係として追加されます。 | |||
次の例は、AppImageとしても配布されているプログラム、Qubaの派生です。 | |||
</div> | </div> | ||
< | <syntaxhighlight lang="nix"> | ||
{ | |||
</ | lib, | ||
appimageTools, | |||
fetchurl, | |||
}: | |||
let | |||
version = "1.4.0"; | |||
pname = "quba"; | |||
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.wrapType2 rec { | |||
inherit pname version src; | |||
extraInstallCommands = '' | |||
substituteInPlace $out/share/applications/${pname}.desktop \ | |||
--replace-fail 'Exec=AppRun' 'Exec=${meta.mainProgram}' | |||
''; | |||
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> | |||
== 設定 == | |||
<span id="Register_AppImage_files_as_a_binary_type_to_binfmt_misc"></span> | |||
=== AppImageファイルタイプをバイナリタイプとしてbinfmt_miscに登録する === | |||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
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: | |||
</div> | </div> | ||
<syntaxhighlight lang="nixos"> | <syntaxhighlight lang="nixos"> | ||
programs.appimage = { | programs.appimage = { | ||
| Line 36: | Line 79: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
この方法では、AppImageファイルを通常のプログラムのように直接呼び出すことができます。 | |||
[[Category:Software | [[Category:Software]] | ||
Latest revision as of 17:17, 7 October 2025
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.
使い方
実行
ほとんどのLinuxディストリビューションでは、.AppImageファイルをダウンロードし、それを実行可能ファイルchmod +x $AppImageにして実行するだけです。ただし、AppImageファイルは通常(常にではないにしても)ハードコードされたパス内の特定のシステムライブラリに依存するため、NixOSではそのままでは機能しません。
$ nix-shell -p appimage-run
$ appimage-run $AppImageFile
パッケージング
nixpkgs manual on wrapping AppImage packagesを参照してください。要するに、AppImageが抽出され、依存関係がnixビルド依存関係として追加されます。 次の例は、AppImageとしても配布されているプログラム、Qubaの派生です。
{
lib,
appimageTools,
fetchurl,
}:
let
version = "1.4.0";
pname = "quba";
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.wrapType2 rec {
inherit pname version src;
extraInstallCommands = ''
substituteInPlace $out/share/applications/${pname}.desktop \
--replace-fail 'Exec=AppRun' 'Exec=${meta.mainProgram}'
'';
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" ];
};
}
設定
AppImageファイルタイプをバイナリタイプとしてbinfmt_miscに登録する
You can tell the Linux kernel to use an interpreter (e.g. appimage-run) when executing certain binary files through the use of 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 appimage-run as interpreter:
programs.appimage = {
enable = true;
binfmt = true;
};
この方法では、AppImageファイルを通常のプログラムのように直接呼び出すことができます。