nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 dpkg,
6 autoPatchelfHook,
7 makeWrapper,
8 electron,
9 asar,
10 alsa-lib,
11 gtk3,
12 libxshmfence,
13 libgbm,
14 nss,
15}:
16
17stdenv.mkDerivation rec {
18 pname = "morgen";
19 version = "3.6.19";
20
21 src = fetchurl {
22 name = "morgen-${version}.deb";
23 url = "https://dl.todesktop.com/210203cqcj00tw1/versions/${version}/linux/deb";
24 hash = "sha256-9zIs5Z6o9cH7dcVGGCKfCBr/9rR9wvQbs6BZJC3KFiQ=";
25 };
26
27 nativeBuildInputs = [
28 dpkg
29 autoPatchelfHook
30 makeWrapper
31 asar
32 ];
33
34 buildInputs = [
35 alsa-lib
36 gtk3
37 libxshmfence
38 libgbm
39 nss
40 ];
41
42 installPhase = ''
43 runHook preInstall
44
45 mv usr $out
46 mv opt $out
47
48 asar extract $out/opt/Morgen/resources/app.asar "$TMP/work"
49 # 1. Fixes path for todesktop-runtime-config.json
50 # 2. Fixes startup script
51 substituteInPlace $TMP/work/dist/main.js \
52 --replace "process.resourcesPath,\"todesktop-runtime-config.json" "\"$out/opt/Morgen/resources/todesktop-runtime-config.json" \
53 --replace "Exec=\".concat(process.execPath," "Exec=\".concat(\"$out/bin/morgen\","
54 asar pack --unpack='{*.node,*.ftz,rect-overlay}' "$TMP/work" $out/opt/Morgen/resources/app.asar
55
56 substituteInPlace $out/share/applications/morgen.desktop \
57 --replace '/opt/Morgen' $out/bin
58
59 makeWrapper ${electron}/bin/electron $out/bin/morgen \
60 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations,WebRTCPipeWireCapturer --enable-wayland-ime=true}} $out/opt/Morgen/resources/app.asar"
61
62 runHook postInstall
63 '';
64
65 passthru.updateScript = ./update.sh;
66
67 meta = {
68 description = "All-in-one Calendars, Tasks and Scheduler";
69 homepage = "https://morgen.so/";
70 mainProgram = "morgen";
71 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
72 license = lib.licenses.unfree;
73 maintainers = with lib.maintainers; [ justanotherariel ];
74 platforms = [ "x86_64-linux" ];
75 };
76}