lol

Merge pull request #258236 from jakuzure/roam-research-darwin

authored by

Artturi and committed by
GitHub
47db6b44 5c8cafbb

+136 -80
+22
pkgs/applications/office/roam-research/common.nix
··· 1 + { fetchurl }: 2 + let 3 + pname = "roam-research"; 4 + version = "0.0.18"; 5 + in 6 + { 7 + inherit pname version; 8 + sources = { 9 + x86_64-darwin = fetchurl { 10 + url = "https://roam-electron-deploy.s3.us-east-2.amazonaws.com/Roam+Research-${version}.dmg"; 11 + hash = "sha256-jyFNH3qrgrsftExL/b2t8bY3W3fYVz+Gp11AuaIMxbg="; 12 + }; 13 + aarch64-darwin = fetchurl { 14 + url = "https://roam-electron-deploy.s3.us-east-2.amazonaws.com/Roam+Research-${version}-arm64.dmg"; 15 + hash = "sha256-AnyvFCbyUi6tcgxYQAj+zPLl4/kVh9ZeupetRhzH0PU="; 16 + }; 17 + x86_64-linux = fetchurl { 18 + url = "https://roam-electron-deploy.s3.us-east-2.amazonaws.com/${pname}_${version}_amd64.deb"; 19 + hash = "sha256-veDWBFZbODsdaO1UdfuC4w6oGCkeVBe+fqKn5XVHKDQ="; 20 + }; 21 + }; 22 + }
+34
pkgs/applications/office/roam-research/darwin.nix
··· 1 + { lib, stdenv, undmg, fetchurl }: 2 + let 3 + common = import ./common.nix { inherit fetchurl; }; 4 + inherit (stdenv.hostPlatform) system; 5 + in 6 + stdenv.mkDerivation rec { 7 + inherit (common) pname version; 8 + src = common.sources.${system} or (throw "Source for ${pname} is not available for ${system}"); 9 + 10 + appName = "Roam Research"; 11 + 12 + sourceRoot = "."; 13 + 14 + nativeBuildInputs = [ undmg ]; 15 + installPhase = '' 16 + runHook preInstall 17 + 18 + mkdir -p "$out/Applications" 19 + cp -R *.app "$out/Applications" 20 + 21 + mkdir -p $out/bin 22 + ln -s "$out/Applications/${appName}.app/Contents/MacOS/${appName}" "$out/bin/${appName}" 23 + runHook postInstall 24 + ''; 25 + 26 + meta = with lib; { 27 + description = "A note-taking tool for networked thought"; 28 + homepage = "https://roamresearch.com/"; 29 + maintainers = with lib.maintainers; [ dbalan ]; 30 + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 31 + license = licenses.unfree; 32 + platforms = [ "x86_64-darwin" "aarch64-darwin" ]; 33 + }; 34 + }
+7 -80
pkgs/applications/office/roam-research/default.nix
··· 1 - { stdenv, lib, fetchurl, alsa-lib, atk, cairo, cups, dbus, dpkg, expat 2 - , gdk-pixbuf, glib, gtk3, libX11, libXScrnSaver, libXcomposite, libXcursor 3 - , libXdamage, libXext, libXfixes, libXi, libXrandr, libXrender, libXtst, libdrm 4 - , libpulseaudio, libxcb, libxkbcommon, libxshmfence, mesa, nspr, nss, pango 5 - , udev, }: 6 - 1 + { stdenv, callPackage, ... }@args: 7 2 let 8 - libPath = lib.makeLibraryPath [ 9 - alsa-lib 10 - atk 11 - cairo 12 - cups 13 - dbus 14 - expat 15 - gdk-pixbuf 16 - glib 17 - gtk3 18 - libX11 19 - libXcomposite 20 - libXdamage 21 - libXext 22 - libXfixes 23 - libXi 24 - libXrandr 25 - libdrm 26 - libxcb 27 - libxkbcommon 28 - libxshmfence 29 - mesa 30 - nspr 31 - nss 32 - pango 33 - stdenv.cc.cc 34 - libXScrnSaver 35 - libXcursor 36 - libXrender 37 - libXtst 38 - libpulseaudio 39 - udev 40 - ]; 41 - in stdenv.mkDerivation rec { 42 - pname = "roam-research"; 43 - version = "0.0.18"; 44 - 45 - src = fetchurl { 46 - url = 47 - "https://roam-electron-deploy.s3.us-east-2.amazonaws.com/${pname}_${version}_amd64.deb"; 48 - sha256 = "sha256-veDWBFZbODsdaO1UdfuC4w6oGCkeVBe+fqKn5XVHKDQ="; 49 - }; 50 - 51 - nativeBuildInputs = [ dpkg ]; 52 - 53 - unpackPhase = '' 54 - mkdir pkg 55 - dpkg-deb -x $src pkg 56 - sourceRoot=pkg 57 - ''; 58 - 59 - installPhase = '' 60 - mkdir -p "$out/bin" 61 - mv opt "$out/" 62 - 63 - ln -s "$out/opt/Roam Research/roam-research" "$out/bin/roam-research" 64 - patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath "${libPath}:$out/opt/Roam Research:\$ORIGIN" "$out/opt/Roam Research/roam-research" 65 - 66 - mv usr/* "$out/" 67 - 68 - substituteInPlace $out/share/applications/roam-research.desktop \ 69 - --replace "/opt/Roam Research/roam-research" "roam-research" 70 - ''; 71 - 72 - dontPatchELF = true; 73 - meta = with lib; { 74 - description = "A note-taking tool for networked thought."; 75 - homepage = "https://roamresearch.com/"; 76 - maintainers = with lib.maintainers; [ dbalan ]; 77 - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 78 - license = licenses.unfree; 79 - platforms = [ "x86_64-linux" ]; 80 - }; 81 - } 3 + extraArgs = removeAttrs args [ "callPackage" ]; 4 + in 5 + if stdenv.isDarwin then 6 + callPackage ./darwin.nix (extraArgs // { }) 7 + else 8 + callPackage ./linux.nix (extraArgs // { })
+73
pkgs/applications/office/roam-research/linux.nix
··· 1 + { stdenv, lib, fetchurl, alsa-lib, atk, cairo, cups, dbus, dpkg, expat 2 + , gdk-pixbuf, glib, gtk3, libX11, libXScrnSaver, libXcomposite, libXcursor 3 + , libXdamage, libXext, libXfixes, libXi, libXrandr, libXrender, libXtst, libdrm 4 + , libpulseaudio, libxcb, libxkbcommon, libxshmfence, mesa, nspr, nss, pango 5 + , udev, }: 6 + 7 + let 8 + common = import ./common.nix { inherit fetchurl; }; 9 + inherit (stdenv.hostPlatform) system; 10 + libPath = lib.makeLibraryPath [ 11 + alsa-lib 12 + atk 13 + cairo 14 + cups 15 + dbus 16 + expat 17 + gdk-pixbuf 18 + glib 19 + gtk3 20 + libX11 21 + libXcomposite 22 + libXdamage 23 + libXext 24 + libXfixes 25 + libXi 26 + libXrandr 27 + libdrm 28 + libxcb 29 + libxkbcommon 30 + libxshmfence 31 + mesa 32 + nspr 33 + nss 34 + pango 35 + stdenv.cc.cc 36 + libXScrnSaver 37 + libXcursor 38 + libXrender 39 + libXtst 40 + libpulseaudio 41 + udev 42 + ]; 43 + in stdenv.mkDerivation rec { 44 + inherit (common) pname version; 45 + src = common.sources.${system} or (throw "Source for ${pname} is not available for ${system}"); 46 + 47 + nativeBuildInputs = [ dpkg ]; 48 + 49 + installPhase = '' 50 + mkdir -p "$out/bin" 51 + mv opt "$out/" 52 + 53 + ln -s "$out/opt/Roam Research/roam-research" "$out/bin/roam-research" 54 + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath "${libPath}:$out/opt/Roam Research:\$ORIGIN" "$out/opt/Roam Research/roam-research" 55 + 56 + mv usr/* "$out/" 57 + 58 + substituteInPlace $out/share/applications/roam-research.desktop \ 59 + --replace "/opt/Roam Research/roam-research" "roam-research" 60 + ''; 61 + 62 + # autoPatchelfHook/patchelf are not used because they cause the binary to coredump. 63 + dontPatchELF = true; 64 + 65 + meta = with lib; { 66 + description = "A note-taking tool for networked thought"; 67 + homepage = "https://roamresearch.com/"; 68 + maintainers = with lib.maintainers; [ dbalan ]; 69 + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 70 + license = licenses.unfree; 71 + platforms = [ "x86_64-linux" ]; 72 + }; 73 + }