Nixpkgs: Package Request: Zettlr

Created on 2 Mar 2020  路  12Comments  路  Source: NixOS/nixpkgs

Project description
With Zettlr, writing professional texts is easy and motivating: Whether you are a college student, a researcher, a journalist, or an author.

Metadata

packaging request

Most helpful comment

Opening an existing directory works with this, though deleting files seems to be a problem (seems to only have an implementation for deleting to another directory (like gvfs, haven't tested) and no force removal).


nix

    { stdenv, fetchurl
    , mesa, libdrm, atomEnv
    , dpkg, cpio, makeWrapper, wrapGAppsHook, autoPatchelfHook }:

    stdenv.mkDerivation rec {
      pname = "zettlr";
      version = "1.7.1";

      src = fetchurl {
        url = "https://github.com/Zettlr/Zettlr/releases/download/v${version}/Zettlr-${version}-amd64.deb";
        sha256 = "0wylkkx6p9p3hwf50xr0s1kjphld0a64m8gfm438lhg2ypla8q93";
      };

      nativeBuildInputs = [ dpkg makeWrapper wrapGAppsHook ];

      dontUnpack = true;
      dontConfigure = true;
      dontBuild = true;

      installPhase = ''
        runHook preInstall

        dpkg --fsys-tarfile $src | tar --extract

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

        mkdir -p $out/bin
        ln -s $out/share/Zettlr/zettlr $out/bin/zettlr

        runHook postInstall
      '';

      preFixup = ''
        patchelf \
          --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
          --set-rpath "$out/share/Zettlr:${atomEnv.libPath}:${stdenv.lib.makeLibraryPath [ mesa libdrm ]}" \
          $out/share/Zettlr/zettlr
      '';

      dontStrip = true;
      dontPatchELF = true;

      meta = with stdenv.lib; {
        description = "A markdown editor for writing academic texts and taking notes";
        homepage = "https://www.zettlr.com";
        platforms = [ "x86_64-linux" ];
        license = licenses.gpl3;
        maintainers = with maintainers; [ ];
      };
    }

All 12 comments

I was interested in running it on NixOS as well, so I just packaged it. Although it seems to work, I have not tested it enough + I am not completely sure this is the best way to go about packaging it, so I have yet to make a PR for it.

Hey, thank you very very much for packaging this! I'm sorry for the delayed response.

I've not been able to test this yet but it looks good to me so far. Would you be able to create a PR for this? It'll make it easier for others to jump in and comment as well.

Thank you again, it's very much appreciated. ;)

Hey, sorry for the delay.

I've tested it now and it runs, however it will crash stating (zettlr:7902): GLib-GIO-ERROR **: 18:24:05.964: No GSettings schemas are installed on the system when I click on Open existing directory in the top menu. I'm running i3wm, not sure if that's the reason, and I'm not at all well versed in packaging electron-based packages.

Have you encountered this issue?

Thanks again for working on it. :)

Perhaps this issue is relevant.

Hi, I'm also interested in running zettlr in NixOs.
The mentioned error occurs also in my setup (nixos-unstable, plasma-desktop) with @msteen 's package and also when using the zettlr appimage via appimage-run. I tried manually exporting the necessary environment variables as proposed in the fix l-d-s linked, but without success. Also using wrapGAppsHooks as described in the manual didn't fix the issue.

In the end I used the zettlr AppImage as the source and copied the package definition from joplin. With this approach the manual exporting, like it is done in the joplin package, works and it is possible to open folders in zettlr.

The package draft can be found here. Maybe someone with more experience could find out why wrapGAppsHook didn't work with the rpm approach (even when using dontWrap as described in the manual for other wrapped packages).

Perhaps this issue is relevant.

I've not had a chance to test this yet, have you?

Thanks for finding that.

Hi, I'm also interested in running zettlr in NixOs.
The mentioned error occurs also in my setup (nixos-unstable, plasma-desktop) with @msteen 's package and also when using the zettlr appimage via appimage-run. I tried manually exporting the necessary environment variables as proposed in the fix l-d-s linked, but without success. Also using wrapGAppsHooks as described in the manual didn't fix the issue.

In the end I used the zettlr AppImage as the source and copied the package definition from joplin. With this approach the manual exporting, like it is done in the joplin package, works and it is possible to open folders in zettlr.

The package draft can be found here. Maybe someone with more experience could find out why wrapGAppsHook didn't work with the rpm approach (even when using dontWrap as described in the manual for other wrapped packages).

Wow! @maj0e, awesome investigating, thank you. I'm completely out of my depth here with wrapGAppsHook and stuff, but I'm glad you found a solution. Maybe this would get more attention from someone who has experience with this if it becomes a PR.

Hi, I'm also interested in running zettlr in NixOs.
The mentioned error occurs also in my setup (nixos-unstable, plasma-desktop) with @msteen 's package and also when using the zettlr appimage via appimage-run. I tried manually exporting the necessary environment variables as proposed in the fix l-d-s linked, but without success. Also using wrapGAppsHooks as described in the manual didn't fix the issue.

In the end I used the zettlr AppImage as the source and copied the package definition from joplin. With this approach the manual exporting, like it is done in the joplin package, works and it is possible to open folders in zettlr.

The package draft can be found here. Maybe someone with more experience could find out why wrapGAppsHook didn't work with the rpm approach (even when using dontWrap as described in the manual for other wrapped packages).

This one is running nicely on my machine. But you are right it would be nice to find out what's wrong with wrapGAppsHook.

Opening an existing directory works with this, though deleting files seems to be a problem (seems to only have an implementation for deleting to another directory (like gvfs, haven't tested) and no force removal).


nix

    { stdenv, fetchurl
    , mesa, libdrm, atomEnv
    , dpkg, cpio, makeWrapper, wrapGAppsHook, autoPatchelfHook }:

    stdenv.mkDerivation rec {
      pname = "zettlr";
      version = "1.7.1";

      src = fetchurl {
        url = "https://github.com/Zettlr/Zettlr/releases/download/v${version}/Zettlr-${version}-amd64.deb";
        sha256 = "0wylkkx6p9p3hwf50xr0s1kjphld0a64m8gfm438lhg2ypla8q93";
      };

      nativeBuildInputs = [ dpkg makeWrapper wrapGAppsHook ];

      dontUnpack = true;
      dontConfigure = true;
      dontBuild = true;

      installPhase = ''
        runHook preInstall

        dpkg --fsys-tarfile $src | tar --extract

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

        mkdir -p $out/bin
        ln -s $out/share/Zettlr/zettlr $out/bin/zettlr

        runHook postInstall
      '';

      preFixup = ''
        patchelf \
          --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
          --set-rpath "$out/share/Zettlr:${atomEnv.libPath}:${stdenv.lib.makeLibraryPath [ mesa libdrm ]}" \
          $out/share/Zettlr/zettlr
      '';

      dontStrip = true;
      dontPatchELF = true;

      meta = with stdenv.lib; {
        description = "A markdown editor for writing academic texts and taking notes";
        homepage = "https://www.zettlr.com";
        platforms = [ "x86_64-linux" ];
        license = licenses.gpl3;
        maintainers = with maintainers; [ ];
      };
    }

@tfmoraes Hmm, looks like gst-plugins-base-0.10.36 is broken. :(

@eadwu I tried your build, but I'm still unable to trigger a file-open dialogue. Instead it'll crash with this (zettlr:21450): GLib-GIO-ERROR **: 17:12:57.918: No GSettings schemas are installed on the system.

So very awesome! Thank you everyone who worked on this for getting it in nixpkgs! <3

Was this page helpful?
0 / 5 - 0 ratings