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

This commit is contained in:
Artturi 2023-10-05 08:38:36 +03:00 committed by GitHub
commit 47db6b4417
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 136 additions and 80 deletions

View File

@ -0,0 +1,22 @@
{ fetchurl }:
let
pname = "roam-research";
version = "0.0.18";
in
{
inherit pname version;
sources = {
x86_64-darwin = fetchurl {
url = "https://roam-electron-deploy.s3.us-east-2.amazonaws.com/Roam+Research-${version}.dmg";
hash = "sha256-jyFNH3qrgrsftExL/b2t8bY3W3fYVz+Gp11AuaIMxbg=";
};
aarch64-darwin = fetchurl {
url = "https://roam-electron-deploy.s3.us-east-2.amazonaws.com/Roam+Research-${version}-arm64.dmg";
hash = "sha256-AnyvFCbyUi6tcgxYQAj+zPLl4/kVh9ZeupetRhzH0PU=";
};
x86_64-linux = fetchurl {
url = "https://roam-electron-deploy.s3.us-east-2.amazonaws.com/${pname}_${version}_amd64.deb";
hash = "sha256-veDWBFZbODsdaO1UdfuC4w6oGCkeVBe+fqKn5XVHKDQ=";
};
};
}

View File

@ -0,0 +1,34 @@
{ lib, stdenv, undmg, fetchurl }:
let
common = import ./common.nix { inherit fetchurl; };
inherit (stdenv.hostPlatform) system;
in
stdenv.mkDerivation rec {
inherit (common) pname version;
src = common.sources.${system} or (throw "Source for ${pname} is not available for ${system}");
appName = "Roam Research";
sourceRoot = ".";
nativeBuildInputs = [ undmg ];
installPhase = ''
runHook preInstall
mkdir -p "$out/Applications"
cp -R *.app "$out/Applications"
mkdir -p $out/bin
ln -s "$out/Applications/${appName}.app/Contents/MacOS/${appName}" "$out/bin/${appName}"
runHook postInstall
'';
meta = with lib; {
description = "A note-taking tool for networked thought";
homepage = "https://roamresearch.com/";
maintainers = with lib.maintainers; [ dbalan ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = [ "x86_64-darwin" "aarch64-darwin" ];
};
}

View File

@ -1,81 +1,8 @@
{ stdenv, lib, fetchurl, alsa-lib, atk, cairo, cups, dbus, dpkg, expat
, gdk-pixbuf, glib, gtk3, libX11, libXScrnSaver, libXcomposite, libXcursor
, libXdamage, libXext, libXfixes, libXi, libXrandr, libXrender, libXtst, libdrm
, libpulseaudio, libxcb, libxkbcommon, libxshmfence, mesa, nspr, nss, pango
, udev, }:
{ stdenv, callPackage, ... }@args:
let
libPath = lib.makeLibraryPath [
alsa-lib
atk
cairo
cups
dbus
expat
gdk-pixbuf
glib
gtk3
libX11
libXcomposite
libXdamage
libXext
libXfixes
libXi
libXrandr
libdrm
libxcb
libxkbcommon
libxshmfence
mesa
nspr
nss
pango
stdenv.cc.cc
libXScrnSaver
libXcursor
libXrender
libXtst
libpulseaudio
udev
];
in stdenv.mkDerivation rec {
pname = "roam-research";
version = "0.0.18";
src = fetchurl {
url =
"https://roam-electron-deploy.s3.us-east-2.amazonaws.com/${pname}_${version}_amd64.deb";
sha256 = "sha256-veDWBFZbODsdaO1UdfuC4w6oGCkeVBe+fqKn5XVHKDQ=";
};
nativeBuildInputs = [ dpkg ];
unpackPhase = ''
mkdir pkg
dpkg-deb -x $src pkg
sourceRoot=pkg
'';
installPhase = ''
mkdir -p "$out/bin"
mv opt "$out/"
ln -s "$out/opt/Roam Research/roam-research" "$out/bin/roam-research"
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath "${libPath}:$out/opt/Roam Research:\$ORIGIN" "$out/opt/Roam Research/roam-research"
mv usr/* "$out/"
substituteInPlace $out/share/applications/roam-research.desktop \
--replace "/opt/Roam Research/roam-research" "roam-research"
'';
dontPatchELF = true;
meta = with lib; {
description = "A note-taking tool for networked thought.";
homepage = "https://roamresearch.com/";
maintainers = with lib.maintainers; [ dbalan ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
};
}
extraArgs = removeAttrs args [ "callPackage" ];
in
if stdenv.isDarwin then
callPackage ./darwin.nix (extraArgs // { })
else
callPackage ./linux.nix (extraArgs // { })

View File

@ -0,0 +1,73 @@
{ stdenv, lib, fetchurl, alsa-lib, atk, cairo, cups, dbus, dpkg, expat
, gdk-pixbuf, glib, gtk3, libX11, libXScrnSaver, libXcomposite, libXcursor
, libXdamage, libXext, libXfixes, libXi, libXrandr, libXrender, libXtst, libdrm
, libpulseaudio, libxcb, libxkbcommon, libxshmfence, mesa, nspr, nss, pango
, udev, }:
let
common = import ./common.nix { inherit fetchurl; };
inherit (stdenv.hostPlatform) system;
libPath = lib.makeLibraryPath [
alsa-lib
atk
cairo
cups
dbus
expat
gdk-pixbuf
glib
gtk3
libX11
libXcomposite
libXdamage
libXext
libXfixes
libXi
libXrandr
libdrm
libxcb
libxkbcommon
libxshmfence
mesa
nspr
nss
pango
stdenv.cc.cc
libXScrnSaver
libXcursor
libXrender
libXtst
libpulseaudio
udev
];
in stdenv.mkDerivation rec {
inherit (common) pname version;
src = common.sources.${system} or (throw "Source for ${pname} is not available for ${system}");
nativeBuildInputs = [ dpkg ];
installPhase = ''
mkdir -p "$out/bin"
mv opt "$out/"
ln -s "$out/opt/Roam Research/roam-research" "$out/bin/roam-research"
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" --set-rpath "${libPath}:$out/opt/Roam Research:\$ORIGIN" "$out/opt/Roam Research/roam-research"
mv usr/* "$out/"
substituteInPlace $out/share/applications/roam-research.desktop \
--replace "/opt/Roam Research/roam-research" "roam-research"
'';
# autoPatchelfHook/patchelf are not used because they cause the binary to coredump.
dontPatchELF = true;
meta = with lib; {
description = "A note-taking tool for networked thought";
homepage = "https://roamresearch.com/";
maintainers = with lib.maintainers; [ dbalan ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
};
}