1{
2 lib,
3 fetchurl,
4 appimageTools,
5 writeScript,
6}:
7let
8 pname = "remnote";
9 version = "1.19.56";
10 src = fetchurl {
11 url = "https://download2.remnote.io/remnote-desktop2/RemNote-${version}.AppImage";
12 hash = "sha256-ZH8sbfoBf1s97O36Q9Lf5Q07CTEkM45NXT8VJgAOe4I=";
13 };
14 appimageContents = appimageTools.extractType2 { inherit pname version src; };
15in
16appimageTools.wrapType2 {
17 inherit pname version src;
18
19 extraInstallCommands = ''
20 install -Dm444 ${appimageContents}/remnote.desktop -t $out/share/applications
21 substituteInPlace $out/share/applications/remnote.desktop \
22 --replace-fail 'Exec=AppRun --no-sandbox %U' 'Exec=remnote %u'
23 install -Dm444 ${appimageContents}/remnote.png -t $out/share/pixmaps
24 '';
25
26 passthru.updateScript = writeScript "update.sh" ''
27 #!/usr/bin/env nix-shell
28 #!nix-shell -i bash -p curl coreutils gnused common-updater-scripts
29 set -eu -o pipefail
30 url="$(curl -ILs -w %{url_effective} -o /dev/null https://backend.remnote.com/desktop/linux)"
31 version="$(echo $url | sed -n 's/.*RemNote-\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p')"
32 currentVersion=$(nix-instantiate --eval -E "with import ./. {}; remnote.version or (lib.getVersion remnote)" | tr -d '"')
33 if [[ "$version" != "$currentVersion" ]]; then
34 hash=$(nix-hash --to-sri --type sha256 "$(nix-prefetch-url "$url")")
35 update-source-version remnote "$version" "$hash" --print-changes
36 fi
37 '';
38
39 meta = with lib; {
40 description = "Note-taking application focused on learning and productivity";
41 homepage = "https://remnote.com/";
42 maintainers = with maintainers; [ chewblacka ];
43 license = licenses.unfree;
44 platforms = [ "x86_64-linux" ];
45 mainProgram = "remnote";
46 };
47}