Skip to content

Commit

Permalink
feat: Add comin
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundmiller committed Mar 5, 2024
1 parent 330e722 commit 89b0352
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 18 deletions.
68 changes: 50 additions & 18 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# Utils
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
comin.url = "github:nlewo/comin";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
Expand Down
18 changes: 18 additions & 0 deletions hosts/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
config,
lib,
pkgs,
inputs,
...
}:
with builtins;
Expand Down Expand Up @@ -32,4 +33,21 @@ with lib; {

# So the bitwarden CLI knows where to find my server.
modules.shell.bitwarden.config.server = "bitwarden.com";

imports = [inputs.comin.nixosModules.comin];

services.comin = {
enable = true;
remotes = [
{
name = "local";
url = "/home/emiller/.config/dotfiles/";
}

{
name = "origin";
url = "https://github.com/edmundmiller/dotfiles";
}
];
};
}
105 changes: 105 additions & 0 deletions packages/notion-app-electron.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
lib,
buildNpmPackage,
fetchurl,
copyDesktopItems,
makeDesktopItem,
makeWrapper,
libpng,
libX11,
libXi,
libXtst,
zlib,
electron,
pipewire,
}:
buildNpmPackage rec {
pname = "notion-app-electron";
version = "3.1.1-1";

src = fetchurl {
url = "https://desktop-release.notion-static.com/Notion%20Setup%20${version}.exe";
hash = "sha256-b55742085cf723ea2d13dd6f97969b87329646028f540692fc8e070c16d49958=";
};

# "https://desktop-release.notion-static.com/Notion%20Setup%20${pkgver}.exe"
# https://github.com/WiseLibs/better-sqlite3/releases/download/v9.2.2/better-sqlite3-v9.2.2-electron-v119-linux-x64.tar.gz
#
nativeBuildInputs = [
copyDesktopItems
makeWrapper
];

# robotjs node-gyp dependencies
buildInputs = [
libpng
libX11
libXi
libXtst
zlib
];

npmDepsHash = "sha256-JZVJcKzG4X7YIUvIRWZsDQnHx+dNqCj6kFm8mZaSH2k=";

makeCacheWritable = true;

env.ELECTRON_SKIP_BINARY_DOWNLOAD = 1;

postPatch = ''
substituteInPlace main.js \
--replace "require('electron-is-dev')" "false"
'';

preBuild = ''
# remove some prebuilt binaries
find node_modules -type d -name prebuilds -exec rm -r {} +
'';

postBuild = ''
# generate .asar file
# asarUnpack makes sure to unwrap binaries so that nix can see the RPATH
npm exec electron-builder -- \
--dir \
-c.asarUnpack="**/*.node" \
-c.electronDist=${electron}/libexec/electron \
-c.electronVersion=${electron.version}
'';

installPhase = ''
runHook preInstall
mkdir -p $out/share/notion-app-electron
cp -r dist/*-unpacked/{locales,resources{,.pak}} $out/share/notion-app-electron
makeWrapper ${lib.getExe electron} $out/bin/notion-app-electron \
--add-flags $out/share/jitsi-meet-electron/resources/app.asar \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [pipewire]} \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--inherit-argv0
install -Dm644 resources/icons/512x512.png $out/share/icons/hicolor/512x512/apps/jitsi-meet-electron.png
runHook postInstall
'';


desktopItems = [
(makeDesktopItem {
name = "notion-app-electron";
exec = "notion-app-electron %U";
icon = "notion-app-electron";
desktopName = "Notion";
comment = meta.description;
categories = ["VideoConference" "AudioVideo" "Audio" "Video" "Network"];
mimeTypes = ["x-scheme-handler/jitsi-meet"];
terminal = false;
})
];

meta = with lib; {
description = "Your connected workspace for wiki, docs & projects";
homepage = "https://aur.archlinux.org/packages/notion-app-electron";
mainProgram = "notion-app-electron";
inherit (electron.meta) platforms;
};
}

0 comments on commit 89b0352

Please sign in to comment.