2022-03-07 20:36:18 +00:00
|
|
|
{ stdenv, fetchurl, lib, makeWrapper, electron_16, makeDesktopItem, graphicsmagick
|
2020-09-08 13:23:01 +00:00
|
|
|
, writeScript }:
|
2020-06-25 00:38:32 +00:00
|
|
|
|
|
|
|
let
|
2022-03-07 20:36:18 +00:00
|
|
|
electron = electron_16;
|
2020-09-08 13:23:01 +00:00
|
|
|
icon = fetchurl {
|
|
|
|
url =
|
|
|
|
"https://forum.obsidian.md/uploads/default/original/1X/bf119bd48f748f4fd2d65f2d1bb05d3c806883b5.png";
|
|
|
|
sha256 = "18ylnbvxr6k4x44c4i1d55wxy2dq4fdppp43a4wl6h6zar0sc9s2";
|
|
|
|
};
|
|
|
|
|
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "obsidian";
|
|
|
|
desktopName = "Obsidian";
|
|
|
|
comment = "Knowledge base";
|
|
|
|
icon = "obsidian";
|
|
|
|
exec = "obsidian";
|
2022-02-22 14:56:15 +00:00
|
|
|
categories = [ "Office" ];
|
2020-09-08 13:23:01 +00:00
|
|
|
};
|
2020-06-25 00:38:32 +00:00
|
|
|
|
2020-09-08 13:23:01 +00:00
|
|
|
updateScript = writeScript "obsidian-updater" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl jq common-updater-scripts
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
latestVersion="$(curl -sS https://raw.githubusercontent.com/obsidianmd/obsidian-releases/master/desktop-releases.json | jq -r '.latestVersion')"
|
|
|
|
|
|
|
|
update-source-version obsidian "$latestVersion"
|
|
|
|
'';
|
2020-06-25 00:38:32 +00:00
|
|
|
|
2020-09-08 13:23:01 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "obsidian";
|
2022-03-07 20:36:18 +00:00
|
|
|
version = "0.13.30";
|
2020-06-25 00:38:32 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-05-11 15:12:35 +00:00
|
|
|
url = "https://github.com/obsidianmd/obsidian-releases/releases/download/v${version}/obsidian-${version}.tar.gz";
|
2022-03-07 20:36:18 +00:00
|
|
|
sha256 = "ymdqdDD7WWfol/jLBsz8tEzcN7Ed1HSIrkuA51cvKKw=";
|
2020-06-25 00:38:32 +00:00
|
|
|
};
|
|
|
|
|
2020-09-08 13:23:01 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper graphicsmagick ];
|
|
|
|
|
|
|
|
installPhase = ''
|
2021-05-11 15:12:35 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2020-09-08 13:23:01 +00:00
|
|
|
mkdir -p $out/bin
|
|
|
|
|
|
|
|
makeWrapper ${electron}/bin/electron $out/bin/obsidian \
|
2021-02-25 07:02:19 +00:00
|
|
|
--add-flags $out/share/obsidian/app.asar
|
2020-09-08 13:23:01 +00:00
|
|
|
|
2021-02-25 07:02:19 +00:00
|
|
|
install -m 444 -D resources/app.asar $out/share/obsidian/app.asar
|
|
|
|
install -m 444 -D resources/obsidian.asar $out/share/obsidian/obsidian.asar
|
2020-09-08 13:23:01 +00:00
|
|
|
|
|
|
|
install -m 444 -D "${desktopItem}/share/applications/"* \
|
|
|
|
-t $out/share/applications/
|
|
|
|
|
|
|
|
for size in 16 24 32 48 64 128 256 512; do
|
|
|
|
mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
|
|
|
|
gm convert -resize "$size"x"$size" ${icon} $out/share/icons/hicolor/"$size"x"$size"/apps/obsidian.png
|
|
|
|
done
|
2021-05-11 15:12:35 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2020-06-25 00:38:32 +00:00
|
|
|
'';
|
|
|
|
|
2020-09-08 13:23:01 +00:00
|
|
|
passthru.updateScript = updateScript;
|
2020-06-25 15:59:43 +00:00
|
|
|
|
2020-06-25 00:38:32 +00:00
|
|
|
meta = with lib; {
|
2020-09-08 13:23:01 +00:00
|
|
|
description =
|
2020-10-26 04:08:40 +00:00
|
|
|
"A powerful knowledge base that works on top of a local folder of plain text Markdown files";
|
2020-06-25 00:38:32 +00:00
|
|
|
homepage = "https://obsidian.md";
|
2022-03-07 20:36:18 +00:00
|
|
|
downloadPage = "https://github.com/obsidianmd/obsidian-releases/releases";
|
2020-06-25 15:05:27 +00:00
|
|
|
license = licenses.obsidian;
|
2020-09-08 13:23:01 +00:00
|
|
|
maintainers = with maintainers; [ conradmearns zaninime ];
|
2020-06-25 00:38:32 +00:00
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
2020-09-08 13:23:01 +00:00
|
|
|
}
|