about summary refs log tree commit diff
path: root/pkgs/by-name/re/remnote/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/re/remnote/package.nix')
-rw-r--r--pkgs/by-name/re/remnote/package.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/pkgs/by-name/re/remnote/package.nix b/pkgs/by-name/re/remnote/package.nix
new file mode 100644
index 0000000000000..b0a3fc50d88ba
--- /dev/null
+++ b/pkgs/by-name/re/remnote/package.nix
@@ -0,0 +1,47 @@
+{
+  lib,
+  fetchurl,
+  appimageTools,
+  writeScript,
+}:
+let
+  pname = "remnote";
+  version = "1.16.72";
+  src = fetchurl {
+    url = "https://download2.remnote.io/remnote-desktop2/RemNote-${version}.AppImage";
+    hash = "sha256-BoKxQ8ngfShm7tC+ojgIR8krq82gJOdbGy8/K7yDRLM=";
+  };
+  appimageContents = appimageTools.extractType2 { inherit pname version src; };
+in
+appimageTools.wrapType2 {
+  inherit pname version src;
+
+  extraInstallCommands = ''
+    install -Dm444 ${appimageContents}/remnote.desktop -t $out/share/applications
+    substituteInPlace $out/share/applications/remnote.desktop \
+      --replace-fail 'Exec=AppRun --no-sandbox %U' 'Exec=remnote %u'
+    install -Dm444 ${appimageContents}/remnote.png -t $out/share/pixmaps
+  '';
+
+  passthru.updateScript = writeScript "update.sh" ''
+    #!/usr/bin/env nix-shell
+    #!nix-shell -i bash -p curl coreutils gnused common-updater-scripts
+    set -eu -o pipefail
+    url="$(curl -ILs -w %{url_effective} -o /dev/null https://backend.remnote.com/desktop/linux)"
+    version="$(echo $url | sed -n 's/.*RemNote-\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p')"
+    currentVersion=$(nix-instantiate --eval -E "with import ./. {}; remnote.version or (lib.getVersion remnote)" | tr -d '"')
+    if [[ "$version" != "$currentVersion" ]]; then
+      hash=$(nix-hash --to-sri --type sha256 "$(nix-prefetch-url "$url")")
+      update-source-version remnote "$version" "$hash" --print-changes
+    fi
+  '';
+
+  meta = with lib; {
+    description = "Note-taking application focused on learning and productivity";
+    homepage = "https://remnote.com/";
+    maintainers = with maintainers; [ chewblacka ];
+    license = licenses.unfree;
+    platforms = [ "x86_64-linux" ];
+    mainProgram = "remnote";
+  };
+}