AppImage request

Hello!

It would be immensely appreciated if you could provide an AppImage of Inkdrop. In addition to Ubuntu (where Inkdrop has worked great!), I also use a Linux distribution called NixOS, and due to NixOS’s design, it is rather difficult to package most closed source software – though AppImage would be trivial to support.

I’m a major contributor to (and package developer for) NixOS, and I would love to add seamless support for Inkdrop (and tell all of my NixOS friends to check out Inkdrop). Would it be possible for you to provide an AppImage build, pretty please? :smiley:

1 Like

Hi Charles,

Thank you for the suggestion.
Providing an AppImage would be nice.
Since I’m developing it alone and haven’t ever used NixOS, would you help me make it?
Here is the Snap package that would be helpful for making it:

1 Like

Hi Takuya,

Time permitting, I might see if I can help with an AppImage.

Other exciting news: I managed to write a NixOS package for Inkdrop that appears to be fully working (including plugins):

{ stdenv, alsaLib, atk, at-spi2-atk, cairo, cups, dbus, dpkg, expat, fontconfig, freetype
, fetchurl, gdk-pixbuf, glib, gtk2, gtk3, libpulseaudio, makeWrapper, nspr
, nss, pango, udev, xorg
, libuuid, at-spi2-core, libsecret
, coreutils
}:

let
  version = "5.2.1";

  deps = [
    libuuid
    libsecret
    alsaLib
    atk
    at-spi2-atk
    at-spi2-core
    cairo
    cups
    dbus
    expat
    fontconfig
    freetype
    gdk-pixbuf
    glib
    gtk2
    gtk3
    libpulseaudio
    nspr
    nss
    pango
    stdenv.cc.cc
    udev
    xorg.libX11
    xorg.libxcb
    xorg.libXcomposite
    xorg.libXcursor
    xorg.libXdamage
    xorg.libXext
    xorg.libXfixes
    xorg.libXi
    xorg.libXrandr
    xorg.libXrender
    xorg.libXScrnSaver
    xorg.libXtst
    xorg.libxkbfile
  ];

in

stdenv.mkDerivation {
  pname = "inkdrop";
  inherit version;

  src = fetchurl {
    url = "https://d3ip0rje8grhnl.cloudfront.net/v${version}/inkdrop_${version}_amd64.deb";
    hash = "sha256-JI0H25Bu7uk3ASMo65Gv1YxPc9tC+tAb7M7wFPMyvxk=";
  };

  dontBuild = true;
  buildInputs = [ dpkg makeWrapper ];

  unpackPhase = ''
    dpkg --fsys-tarfile $src | tar --extract
  '';

  installPhase = ''
    rm -r ./usr/share/lintian
    rm -r ./usr/share/doc

    mkdir -p $out
    cp -r ./usr/share $out
    cp -r ./usr/bin $out
    cp -r ./usr/lib $out

    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
             "$out/lib/inkdrop/inkdrop"

    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
             "$out/lib/inkdrop/resources/app/ipm/bin/node"

    wrapProgram $out/lib/inkdrop/inkdrop \
      --prefix LD_LIBRARY_PATH : "$out/lib/inkdrop" \
      --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath deps}"

    wrapProgram $out/lib/inkdrop/resources/app/ipm/bin/ipm \
      --prefix PATH : "${coreutils.out}/bin" \
      --prefix LD_LIBRARY_PATH : "$out/lib/inkdrop" \
      --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath deps}"
  '';

  meta = {
    homepage = "https://www.inkdrop.app/";
    description = "Organizing your Markdown notes made simple";
    license = stdenv.lib.licenses.unfreeRedistributable;
    platforms = [ "x86_64-linux" ];
    maintainers = [ stdenv.lib.maintainers.cstrahan ];
  };
}

I’ll see if I can get this merged into Nixpkgs.

4 Likes

That’s great news!
Thanks so much for the work :pray::raised_hands:

2 Likes

Hi @Charles_Strahan, I’m using your expression for Nix and I get this error, any idea?

Thanks!

Any idea here @craftzdog?

Thanks!

I’m getting this error after update to 5.5.0:

image

you need to install gnome-keyring or other similar keyring that can stores secrets. Or if it’s already installed in the case of NixOS (I’ve never actually used it) you might need to start/enable the service.

2 Likes

Solved!

I had to add gnome.gnome-keyring service to my configuration.nix file.

I’ve updated the @Charles_Strahan nix expression to the last version and works fine:

{ stdenv
, lib
, libxkbcommon
, libdrm
, alsaLib
, atk
, at-spi2-atk
, cairo
, cups
, dbus
, dpkg
, expat
, fontconfig
, freetype
, fetchurl
, gdk-pixbuf
, glib
, gtk2
, gtk3
, libpulseaudio
, makeWrapper
, nspr
, nss
, pango
, udev
, xorg
, libuuid
, at-spi2-core
, libsecret
, coreutils
, mesa
, gnome
}:

let
  version = "5.5.0";

  deps = [
    libxkbcommon
    libuuid
    libdrm
    libsecret
    alsaLib
    atk
    at-spi2-atk
    at-spi2-core
    cairo
    cups
    dbus
    expat
    fontconfig
    freetype
    gdk-pixbuf
    glib
    gtk2
    gtk3
    libpulseaudio
    nspr
    nss
    pango
    stdenv.cc.cc
    udev
    xorg.libX11
    xorg.libxcb
    xorg.libXcomposite
    xorg.libXcursor
    xorg.libXdamage
    xorg.libXext
    xorg.libXfixes
    xorg.libXi
    xorg.libXrandr
    xorg.libXrender
    xorg.libXScrnSaver
    xorg.libXtst
    xorg.libxkbfile
    xorg.libxshmfence
    mesa
    gnome.gnome-keyring
  ];

in

stdenv.mkDerivation {
  pname = "inkdrop";
  inherit version;

  src = fetchurl {
    url = "https://d3ip0rje8grhnl.cloudfront.net/v${version}/inkdrop_${version}_amd64.deb";
    # hash = "sha256-JI0H25Bu7uk3ASMo65Gv1YxPc9tC+tAb7M7wFPMyvxk=";
    # hash = "sha256:06dz6bri9w6fxhdx1yj2vdrlz36mmy8yna1304vykvkfj3dhg394";
    # hash = "sha256:183rnh965nxn5vzkgn2q087j0lzi6ly1jg5w3q44zgc8jrgzxyc8";
    hash = "sha256:1l8fxx7p2bg7fck2da9cj0g1xx9ql32v5hyqxjkwarv0xz0fv24f";
  };

  dontBuild = true;
  buildInputs = [ dpkg makeWrapper ];

  unpackPhase = ''
    dpkg --fsys-tarfile $src | tar --extract
  '';

  installPhase = ''
    rm -r ./usr/share/lintian
    rm -r ./usr/share/doc

    mkdir -p $out
    cp -r ./usr/share $out
    cp -r ./usr/bin $out
    cp -r ./usr/lib $out

    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
             "$out/lib/inkdrop/inkdrop"

    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
             "$out/lib/inkdrop/resources/app/ipm/bin/node"

    wrapProgram $out/lib/inkdrop/inkdrop \
      --prefix LD_LIBRARY_PATH : "$out/lib/inkdrop" \
      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath deps}"

    wrapProgram $out/lib/inkdrop/resources/app/ipm/bin/ipm \
      --prefix PATH : "${coreutils.out}/bin" \
      --prefix LD_LIBRARY_PATH : "$out/lib/inkdrop" \
      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath deps}"
  '';

  meta = with lib; {
    homepage = "https://www.inkdrop.app/";
    description = "Organizing your Markdown notes made simple";
    license = licenses.unfreeRedistributable;
    platforms = [ "x86_64-linux" ];
    maintainers = [ maintainers.cstrahan ];
  };
}

cc @craftzdog :slight_smile:

2 Likes

@anon94533569 awesome :tada:

@anon94533569 and @Charles_Strahan I copied your configuration.nix file but seem to be having the following error:

error: anonymous function at /nix/store/hsd831yk61nkxww276g94n4gmyyfxa0f-source/home-manager/inkdrop.nix:1:1 called with unexpected argument 'inputs'

       at /nix/store/9qaip1bfz0wjb8503a3vw66fqnqmgwai-source/lib/modules.nix:490:8:

          489|       # works.
          490|     in f (args // extraArgs)
             |        ^
          491|   else
(use '--show-trace' to show detailed location information)

Have you had this issue? Or do you have a working nixos configuration file on Github that is available?

Howdy,

I’ve updated the package to install the latest 5.11.6 version of Inkdrop.
I’m learning Nix so it might or might not work flawlessly :sweat_smile:

{
  stdenv,
  lib,
  alsa-lib,
  atk,
  at-spi2-atk,
  cairo,
  cups,
  dbus,
  dpkg,
  expat,
  fontconfig,
  freetype,
  fetchurl,
  gdk-pixbuf,
  glib,
  gtk2,
  gtk3,
  libpulseaudio,
  makeWrapper,
  nspr,
  nss,
  pango,
  udev,
  xorg,
  libuuid,
  at-spi2-core,
  libsecret,
  coreutils,
  libdrm,
  libgbm,
  libxkbcommon,
  libGL,
}:

let
  version = "5.11.6";

  deps = [
    libuuid
    libsecret
    alsa-lib
    atk
    at-spi2-atk
    at-spi2-core
    cairo
    cups
    dbus
    expat
    fontconfig
    freetype
    gdk-pixbuf
    glib
    gtk2
    gtk3
    libpulseaudio
    nspr
    nss
    pango
    stdenv.cc.cc
    udev
    xorg.libX11
    xorg.libxcb
    xorg.libXcomposite
    xorg.libXcursor
    xorg.libXdamage
    xorg.libXext
    xorg.libXfixes
    xorg.libXi
    xorg.libXrandr
    xorg.libXrender
    xorg.libXScrnSaver
    xorg.libXtst
    xorg.libxkbfile
    libdrm
    libgbm
    libxkbcommon
    libGL
  ];

in

stdenv.mkDerivation {
  pname = "inkdrop";
  inherit version;

  src = fetchurl {
    url = "https://d3ip0rje8grhnl.cloudfront.net/v${version}/inkdrop_${version}_amd64.deb";
    hash = "sha256-AdimOAnWxLk5Z4X5YKrlWrxl1miR0Cs8CvIzC5wUKWw=";
  };

  dontBuild = true;
  buildInputs = [
    dpkg
    makeWrapper
  ];

  unpackPhase = ''
    dpkg --fsys-tarfile $src | tar --extract
  '';

  installPhase = ''
    rm -r ./usr/share/lintian
    rm -r ./usr/share/doc

    mkdir -p $out
    cp -r ./usr/share $out
    cp -r ./usr/bin $out
    cp -r ./usr/lib $out

    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
             "$out/lib/inkdrop/inkdrop"

    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
             "$out/lib/inkdrop/resources/app/ipm/bin/node"

    wrapProgram $out/lib/inkdrop/inkdrop \
      --prefix LD_LIBRARY_PATH : "$out/lib/inkdrop" \
      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath deps}"

    wrapProgram $out/lib/inkdrop/resources/app/ipm/bin/ipm \
      --prefix PATH : "${coreutils.out}/bin" \
      --prefix LD_LIBRARY_PATH : "$out/lib/inkdrop" \
      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath deps}"
  '';

  meta = {
    homepage = "https://www.inkdrop.app/";
    description = "Organizing your Markdown notes made simple";
    license = lib.licenses.unfreeRedistributable;
    platforms = [ "x86_64-linux" ];
    maintainers = [ lib.maintainers.cstrahan ];
  };
}
1 Like

Shorter version of the last script, since all the declared deps are in pkgs, you can use with pkgs;

{ pkgs, stdenv, fetchurl, coreutils, lib, ... }:

let
  deps = with pkgs; [
    libuuid
    libsecret
    alsa-lib
    atk
    at-spi2-atk
    at-spi2-core
    cairo
    cups
    dbus
    expat
    fontconfig
    freetype
    gdk-pixbuf
    glib
    gtk2
    gtk3
    libpulseaudio
    nspr
    nss
    pango
    stdenv.cc.cc
    udev
    xorg.libX11
    xorg.libxcb
    xorg.libXcomposite
    xorg.libXcursor
    xorg.libXdamage
    xorg.libXext
    xorg.libXfixes
    xorg.libXi
    xorg.libXrandr
    xorg.libXrender
    xorg.libXScrnSaver
    xorg.libXtst
    xorg.libxkbfile
    libdrm
    libgbm
    libxkbcommon
    libGL
  ];
in

stdenv.mkDerivation rec {
  pname = "inkdrop";
  version = "5.11.6";

  src = pkgs.fetchurl {
    url = "https://d3ip0rje8grhnl.cloudfront.net/v${version}/inkdrop_${version}_amd64.deb";
    hash = "sha256-AdimOAnWxLk5Z4X5YKrlWrxl1miR0Cs8CvIzC5wUKWw=";
  };

  buildInputs = with pkgs; [
    dpkg
    makeWrapper
  ];

  dontBuild = true;

  unpackPhase = ''
    dpkg --fsys-tarfile $src | tar --extract
  '';

  installPhase = ''
    rm -r ./usr/share/lintian
    rm -r ./usr/share/doc

    mkdir -p $out
    cp -r ./usr/share $out
    cp -r ./usr/bin $out
    cp -r ./usr/lib $out

    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
             "$out/lib/inkdrop/inkdrop"

    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
             "$out/lib/inkdrop/resources/app/ipm/bin/node"

    wrapProgram $out/lib/inkdrop/inkdrop \
      --prefix LD_LIBRARY_PATH : "$out/lib/inkdrop" \
      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath deps}"

    wrapProgram $out/lib/inkdrop/resources/app/ipm/bin/ipm \
      --prefix PATH : "${coreutils.out}/bin" \
      --prefix LD_LIBRARY_PATH : "$out/lib/inkdrop" \
      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath deps}"
  '';

  meta = {
    description = "Organizing your Markdown notes made simple";
    homepage = "https://www.inkdrop.app/";
    license = lib.licenses.unfreeRedistributable;
    platforms = [ "x86_64-linux" ];
    maintainers = [ lib.maintainers.rafaeloledo ];
    mainProgram = "inkdrop";
  };
}

Also, you can use rec mkDerivation without the need to declare a variable.

Inside my NixOS Modules config file, i’m declaring a local package with

let
  inkdrop = pkgs.callPackage ./my-packages/inkdrop/inkdrop.nix {};
in

So, you can call it there…

  environment.systemPackages = with pkgs; [
    inkdrop
    
    ...
  ];

There’s no upstream inkdrop.nix package declaration like this in https://search.nixos.org/packages either for NixOS Modules or Home Manager Packages.

In archlinux there’s already a package maintained in AUR PKGBUILD - aur.git - AUR Package Repositories.

On every inkdrop update, we need to change the version and sha256 of the package.

1 Like

Besides canary having now an AppImage, packaging software with nix expressions are the recommended way to use NixOS. It happens that you can only write to /nix/store if you’re using nix API.

I haven’t tried to wrap an AppImage with nix expressions, which may be possible.

Exiting from that matter, i’ve also done a version for the canary release.

{ pkgs, stdenv, fetchurl, coreutils, lib, ... }:

let
  deps = with pkgs; [
    libuuid
    libsecret
    alsa-lib
    atk
    at-spi2-atk
    at-spi2-core
    cairo
    cups
    dbus
    expat
    fontconfig
    freetype
    gdk-pixbuf
    glib
    gtk2
    gtk3
    libpulseaudio
    nspr
    nss
    pango
    stdenv.cc.cc
    udev
    xorg.libX11
    xorg.libxcb
    xorg.libXcomposite
    xorg.libXcursor
    xorg.libXdamage
    xorg.libXext
    xorg.libXfixes
    xorg.libXi
    xorg.libXrandr
    xorg.libXrender
    xorg.libXScrnSaver
    xorg.libXtst
    xorg.libxkbfile
    libdrm
    libgbm
    libxkbcommon
    libGL
  ];
in

stdenv.mkDerivation rec {
  pname = "inkdrop";
  version = "6.0.0-canary.4";

  src = pkgs.fetchurl {
    url = "https://dist.inkdrop.app/releases/canary/inkdrop-${version}-amd64-linux.deb";
    hash = "sha256-viUABpxf8j3NJ/HqBFNaA9G/FXZT6nA3L0m1ISM977s=";
  };

  buildInputs = with pkgs; [
    dpkg
    makeWrapper
  ];

  dontBuild = true;

  unpackPhase = ''
    dpkg --fsys-tarfile $src | tar --extract
  '';

  installPhase = ''
    rm -r ./usr/share/doc

    mkdir -p $out
    cp -r ./opt $out
    cp -r ./usr/share $out

    patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
      "$out/opt/Inkdrop/inkdrop-canary"

    wrapProgram $out/opt/Inkdrop/inkdrop-canary \
      --prefix LD_LIBRARY_PATH : "$out/opt/Inkdrop/inkdrop-canary" \
      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath deps}"

    mkdir -p "$out/bin"
    ln -nfs "$out/opt/Inkdrop/inkdrop-canary" "$out/bin/inkdrop-canary"
  '';

  meta = {
    description = "Organizing your Markdown notes made simple";
    homepage = "https://www.inkdrop.app/";
    license = lib.licenses.unfreeRedistributable;
    platforms = [ "x86_64-linux" ];
    maintainers = [ lib.maintainers.rafaeloledo ];
    mainProgram = "inkdrop";
  };
}

Some things to point out

  • @craftzdog does ipm get removed ?
  • Installations paths seems to change a bit
  • I’ve changed the domain to dist.inkdrop.app
  • usr/bin get removed and are no more symlink to the executable, the problem is that NixOS automatically links $out/bin (bin folder from the root of the output path produced from any installation) path to the system, if there’s no one, nix does nothing. So, i’ve added
    ...
    mkdir -p "$out/bin"
    ln -nfs "$out/opt/Inkdrop/inkdrop-canary" "$out/bin/inkdrop-canary"
'';

I’ve analyzed archlinux PKGBUILD from AUR. The community is not even using the usr/bin folder but linking directly to the one in lib/inkdrop.

Finally, there are some points to consider

  • It may be desired to maintain the usr/bin folder
  • If the ipm is mapped inside the app now and not as a separate program, this need be clarified
  • Internal updates aren’t possible in NixOS, so the .1 needs to be updated to .4 for the ones that want to test it.

I’ve about 1 year and 6 months using NixOS and the purpose of this post is to help users similar to me.

@anon3962763 Hey, thanks for the work!

Yes, it is no longer bundled. The ipm command will be provided as a standalone CLI tool via npm for v6.

Can it be automated with electron-builder?

If you’re asking about the building with the nixpkg, probably not. These scripts are stored in the nix-community official github repo.

https://search.nixos.org/packages?channel=unstable&query=inkdrop

It’s needed to upload it to the upstream and be approved by maintainers. I don’t know if the above ones are following quality patterns needed for approval. But, they’re working here :laughing: .

If an app isn’t there, we tend to search for flatpak, snap and appimages as well. I’ve tested the snap one and it’s not working :frowning: . Even on FHS distros like arch i’ve the need for easyeffects wrapped with flatpak, it abstract layers from the system. So, if inkdrop support flatpak it may be a good shot.

Edit: i’ve noticed it now supports flatpak on canary
Edit 2: flatpak is working on NixOS without changes with flatseal

Yes, it is no longer bundled. The ipm command will be provided as a standalone CLI tool via npm for v6.

:+1: