Appimage/zh: Difference between revisions
No edit summary |
No edit summary Tags: Mobile edit Mobile web edit |
||
| (8 intermediate revisions by 2 users not shown) | |||
| Line 12: | Line 12: | ||
<syntaxhighlight lang="shell"> | <syntaxhighlight lang="shell"> | ||
$ nix-shell -p appimage-run | $ nix-shell -p appimage-run | ||
$ appimage-run | $ appimage-run path/to/application.AppImage | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<span id="Additional_Packages"></span> | |||
===== 额外软件包 ===== | |||
部分 AppImage 包仍存在问题,因此您可以用额外软件包进行覆盖,例如 | |||
<syntaxhighlight lang="nix">programs.appimage.enable = true; | |||
programs.appimage.binfmt = true; | |||
programs.appimage.package = pkgs.appimage-run.override | |||
{ | |||
extraPkgs = pkgs: | |||
[ | |||
pkgs.icu | |||
pkgs.libxcrypt-legacy | |||
pkgs.python312 | |||
pkgs.python312Packages.torch | |||
]; | |||
}; | |||
</syntaxhighlight> | |||
<span id="Packaging"></span> | <span id="Packaging"></span> | ||
=== 打包 === | === 打包 === | ||
| Line 65: | Line 85: | ||
=== 将 AppImage 文件作为二进制类型注册到 binfmt_misc === | === 将 AppImage 文件作为二进制类型注册到 binfmt_misc === | ||
您可以通过 [https://en.wikipedia.org/wiki/Binfmt_misc#External_links binfmt_misc] 来告诉 [[Special:MyLanguage/Linux kernel|Linux 内核]]在执行某些二进制文件时使用哪个解释器(例如 <code>appimage-run</code>),具体方式可以通过文件扩展名或魔数匹配来实现。下面的 NixOS 配置会注册 AppImage 文件(魔数为“AI”+ 0x02 的 ELF 文件),并使用 <code>appimage-run</code> 作为解释器运行: | |||
您可以通过 [https://en.wikipedia.org/wiki/Binfmt_misc#External_links binfmt_misc] 来告诉 Linux 内核在执行某些二进制文件时使用哪个解释器(例如 <code>appimage-run</code>),具体方式可以通过文件扩展名或魔数匹配来实现。下面的 NixOS 配置会注册 AppImage 文件(魔数为“AI”+ 0x02 的 ELF 文件),并使用 <code>appimage-run</code> 作为解释器运行 | |||
<syntaxhighlight lang="nixos"> | <syntaxhighlight lang="nixos"> | ||
programs.appimage = { | programs.appimage = { | ||
| Line 75: | Line 94: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
这样 AppImage 文件就可以像普通程序一样直接调用 | 这样 AppImage 文件就可以像普通程序一样直接调用。 | ||
[[Category:Software]] | [[Category:Software]] | ||