nixos 不能直接运行appimage,需要封装以下 使用 appimageTools 来运行
相关阅读:nixos 从0实现全集 - 目录 | NixOS 入门指南(第二版)
以hiddify和balenaEtcher为例nix 代码 (37 行)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ pkgs, ... }:
# ./hiddify: error while loading shared libraries: libepoxy.so.0: cannot open shared object file: No such file or directory
{ config, pkgs,nur, ... }:
let
hiddify_pkg = with pkgs; appimageTools.wrapType2
({
# or wrapType1 wrapType2 : file -k XXXXX.AppImage
name = "hiddify";
src = fetchurl {
sha256 = "sha256-T4BWxhJ7q13KE1rvvFsnXhs2XVEmNkFTJbJ4e8PCg+0=";
url = "https://mirror.ghproxy.com/https://github.com/hiddify/hiddify-next/releases/download/v1.1.1/Hiddify-Linux-x64.AppImage";
};
extraPkgs = pkgs: with pkgs; [ libepoxy ];
});
icons=../../staticFile/icons/hiddify.png;
in
{
home.packages = with pkgs; [
hiddify_pkg
];
home.file = {
".local/share/applications/Hiddify-next.desktop".text = ''
[Desktop Entry]
Version=1.1.1
Type=Application
Name=Hiddify
Exec=hiddify
Icon=${icons}
StartupWMClass=hiddify
StartupNotify=true
'';
};
}
nix 代码 (35 行)
| |