How to add appimage in configuration.nix

Hi,

I’m a beginner with nixos, and I probably don’t understand some concepts.

I’m I am trying to install the navicat application which is provided as an appimage. I’ve downloaded the appimage file, and I can run it with appimage-run navicat.Appimage with no problem.
But how can I install this application the nixos way ?
The more I read about appimages and nixos, the less I understand :cry:

Any help will be greatly appreciated

Thx

Appimage packages differently than nix, so having the *.AppImage file wont be installable to the nix store directly. You would have to make a wrapper derivation if you’d like the AppImage “installed” in configuration.nix.

You could do something like this:

let
  navicat = builtins.path = { path = ./navicat.AppImage; name = navicat; };
in
pkgs.symlinkJoin {
  name = "navicat";
  paths = [ pkgs.appimage-run ];
  buildInputs = [ pkgs.makeWrapper ];
  postBuild = ''
    mv $out/bin/appimage-run $out/bin/navicat
    wrapProgram $out/bin/navicat --add-flags "${navicat}"
  '';
};

Thx a lot for your answer. It allowed me to better understand how packages work.

I finally figured out how to add an appimage with appimagestools.

self: super: {
          navicat = super.appimageTools.wrapType1 {
              name = "navicat";
              version = "15";

              src = super.fetchurl {
                  url = "https://download.navicat.com/download/navicat15-premium-en.AppImage";
                  hash = "sha256-UOQlqbh8rmzFn6ZWZEc5QxjmVzLdVbY/vFuLOLrFt6U=";
              };
          };
          navicat-desktop = super.writeTextDir "share/applications/navicat15-premium.desktop" ''
              [Desktop Entry]
              Version=15
              Type=Application
              Name=Navicat
              Exec=navicat
              Icon=~/Applications/icons/navicat-premium.png
          '';
      }

I just have one issue with the icon that is not displayed in gnome, I have a the generic app Icon instead.

2 Likes

Hello,

I upgraded the Navicat Appimage to v16. Now il have two error messages appearing when launching Navicat.

self: super: {
  navicat = super.appimageTools.wrapType1 {
    name = "navicat";
    version = "16";

    src = super.fetchurl {
      url = "https://download3.navicat.com/download/navicat16-premium-en.AppImage";
      hash = "sha256-hO2hm7VEBbhrEsdOAMF9zfAlZg5MBPTqOrrerXu5L/o=";
    };
  };
  navicat-desktop = super.writeTextDir "share/applications/navicat16-premium.desktop" ''
    [Desktop Entry]
    Version=16
    Type=Application
    Name=Navicat
    Exec=navicat
    Icon=/home/pascal/Applications/icons/navicat-premium.png
    StartupWMClass=AppRun
  '';
}

The error messages

cc_lib_mongoc:_load_library:./usr/lib/libmongoc-1.0.so.0:libzstd.so.1: cannot open shared object file: No such file or directory

cc_lib_mongoc:_load_library:./usr/lib/libmongoc-1.0-1.16.2.so:libzstd.so.1: cannot open shared object file: No such file or directory

After that Navicat is launched and works fine, but I’m not using it with any mongo DB.

My nix config for Navicat 16, I only changed, url and hash to download V16

Any ideas how to fix that ?