Appimage: Difference between revisions

Onny (talk | contribs)
Restructure page
Onny (talk | contribs)
Add packaging example
Line 9: Line 9:
== Usage ==
== Usage ==


=== Running an AppImage file on NixOS ===<!--T:3-->
=== Run ===<!--T:3-->


</translate>
</translate>
Line 21: Line 21:
<!--T:9-->
<!--T:9-->
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.
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.
Following example is a derivation for the program Quba, which is also distributed as 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 'Exec=AppRun' 'Exec=${pname}'
    cp -r ${appimageContents}/usr/share/icons $out/share
  '';
  meta = with lib; {
    description = "Viewer for electronic invoices ";
    homepage = "https://github.com/ZUGFeRD/quba-viewer";
    downloadPage = "https://github.com/ZUGFeRD/quba-viewer/releases";
    license = licenses.asl20;
    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
    maintainers = with maintainers; [ onny ];
    platforms = [ "x86_64-linux" ];
  };
}
</syntaxhighlight>


== Configuration ==
== Configuration ==