packages: add whph

This commit is contained in:
Kate 2025-07-22 22:53:55 +02:00
parent 57ab783364
commit e8334a04b2
6 changed files with 128 additions and 20 deletions

View file

@ -124,8 +124,6 @@
"sd_mod"
];
boot.initrd.kernelModules = [ ];
# Support virtualization, thunderbolt, and poking the APCI directly. >.>
boot.kernelModules = [
"thunderbolt"
];
@ -133,6 +131,25 @@
# Support thunderbolt.
services.hardware.bolt.enable = true;
# Support bluetooth.
hardware.bluetooth = {
enable = true;
powerOnBoot = false;
settings = {
General = {
# Support A2DP.
Enable = "Source,Sink,Media,Socket";
# Enable experimental featurees, like reading device battery levels.
Experimental = true;
};
};
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/bb880b80-992f-4e56-bb80-c5c4df0ddd72";
fsType = "ext4";

View file

@ -27,6 +27,7 @@ with pkgs;
gnused
gnugrep
just
qrencode
# Backup things.
keepassxc

View file

@ -105,6 +105,7 @@ with pkgs;
obsidian
onboard
supersonic
deprekages.whph
# Development.
jetbrains-toolbox

View file

@ -45,6 +45,7 @@ flake-utils.lib.eachDefaultSystem (
hrvst-cli = callPackage ./hrvst-cli { };
notion-app = callPackage ./notion-app { inherit _7zz; };
gfn-electron = callPackage ./geforce-now { };
whph = callPackage ./whph.nix { };
# utilities
ykush = callPackage ./ykush.nix { };

View file

@ -7,7 +7,7 @@
asar,
writeScriptBin,
bash,
libgcc
libgcc,
}:
let
better-sqlite3-version = "11.4.0";
@ -38,30 +38,30 @@ let
'';
buildPhase = ''
ls -lah **/*
ls -lah **/*
asar e "Notion/Notion.app/Contents/Resources/app.asar" asar_patched
asar e "Notion/Notion.app/Contents/Resources/app.asar" asar_patched
# replace the native dependencies with linux versions
cp "$betterSqlite3/Release/better_sqlite3.node" "asar_patched/node_modules/better-sqlite3/build/Release/"
# replace the native dependencies with linux versions
cp "$betterSqlite3/Release/better_sqlite3.node" "asar_patched/node_modules/better-sqlite3/build/Release/"
# fully disabling auto updates
sed -i 's/if("darwin"===process.platform){const e=s.systemPreferences?.getUserDefault(E,"boolean"),t=_.Store.getState().app.preferences?.isAutoUpdaterDisabled;return Boolean(e||t)}return!1/return!0/g' "asar_patched/.webpack/main/index.js"
# fully disabling auto updates
sed -i 's/if("darwin"===process.platform){const e=s.systemPreferences?.getUserDefault(E,"boolean"),t=_.Store.getState().app.preferences?.isAutoUpdaterDisabled;return Boolean(e||t)}return!1/return!0/g' "asar_patched/.webpack/main/index.js"
# fix tray icon and right click menu
mkdir -p asar_patched/.webpack/main
cp ${./notion.png} asar_patched/.webpack/main/trayIcon.png
sed -i 's|this.tray.on("click",(()=>{this.onClick()}))|this.tray.setContextMenu(this.trayMenu),this.tray.on("click",(()=>{this.onClick()}))|g' "asar_patched/.webpack/main/index.js"
sed -i 's|getIcon(){[^}]*}|getIcon(){return s.default.join(__dirname, "trayIcon.png");}|g' "asar_patched/.webpack/main/index.js"
# fix tray icon and right click menu
mkdir -p asar_patched/.webpack/main
cp ${./notion.png} asar_patched/.webpack/main/trayIcon.png
sed -i 's|this.tray.on("click",(()=>{this.onClick()}))|this.tray.setContextMenu(this.trayMenu),this.tray.on("click",(()=>{this.onClick()}))|g' "asar_patched/.webpack/main/index.js"
sed -i 's|getIcon(){[^}]*}|getIcon(){return s.default.join(__dirname, "trayIcon.png");}|g' "asar_patched/.webpack/main/index.js"
# avoid running duplicated instances, fixes url opening
sed -i 's|o.app.on("open-url",w.handleOpenUrl)):"win32"===process.platform|o.app.on("open-url",w.handleOpenUrl)):"linux"===process.platform|g' "asar_patched/.webpack/main/index.js"
# avoid running duplicated instances, fixes url opening
sed -i 's|o.app.on("open-url",w.handleOpenUrl)):"win32"===process.platform|o.app.on("open-url",w.handleOpenUrl)):"linux"===process.platform|g' "asar_patched/.webpack/main/index.js"
# fake the useragent as windows to fix the spellchecker languages selector and other issues
sed -i 's|e.setUserAgent(`''${e.getUserAgent()} WantsServiceWorker`),|e.setUserAgent(`''${e.getUserAgent().replace("Linux", "Windows")} WantsServiceWorker`),|g' "asar_patched/.webpack/main/index.js"
# fake the useragent as windows to fix the spellchecker languages selector and other issues
sed -i 's|e.setUserAgent(`''${e.getUserAgent()} WantsServiceWorker`),|e.setUserAgent(`''${e.getUserAgent().replace("Linux", "Windows")} WantsServiceWorker`),|g' "asar_patched/.webpack/main/index.js"
# re-pack the asar
asar p asar_patched app.asar --unpack "*.node"
# re-pack the asar
asar p asar_patched app.asar --unpack "*.node"
'';
installPhase = ''

88
packages/whph.nix Normal file
View file

@ -0,0 +1,88 @@
{
lib,
stdenv,
fetchzip,
autoPatchelfHook,
xorg,
gtk3,
zlib,
pango,
cairo,
harfbuzz,
at-spi2-atk,
gdk-pixbuf,
glib,
gst_all_1,
libayatana-appindicator,
}:
let
this = stdenv.mkDerivation {
pname = "whph";
version = "0.10.1";
src = fetchzip {
url = "https://github.com/ahmet-cetinkaya/whph/releases/download/v${this.version}/whph-v${this.version}-linux.tar.gz";
hash = "sha256-RnxeqZBS7U65Dz0gc/uMDMnWU3tDN/Jx3Czs1gn0rJk=";
stripRoot = false;
};
nativeBuildInputs = [
autoPatchelfHook
];
buildInputs = [
xorg.libSM
xorg.libICE
xorg.libX11
xorg.libXext
gtk3
zlib
pango
cairo
harfbuzz
at-spi2-atk
gdk-pixbuf
glib
gst_all_1.gst-plugins-base
libayatana-appindicator
];
desktopFile = ''
[Desktop Entry]
Version=1.0
Type=Application
Name=WHPH
GenericName=Work Hard Play Hard; Task Manager
Comment=manager for tasks, habits, and screen use in one
Exec=${placeholder "out"}/bin/whph %U
Icon=${placeholder "out"}/opt/${this.pname}/share/icons/hicolor/512x512/apps/whph.png
Categories=Office;ProjectManagement;
MimeType=x-scheme-handler/notion;
StartupNotify=false
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mkdir -p $out/opt/${this.pname}
cp -r $src/* $out/opt/${this.pname}/
addAutoPatchelfSearchPath ${this.src}/lib/
# Launch wrapper.
echo "#!/bin/sh" >> $out/bin/whph
echo "$out/opt/${this.pname}/whph \$@" >> $out/bin/whph
chmod +x $out/bin/whph
# Application menu entry.
mkdir -p $out/share/applications
echo "$desktopFile" > $out/share/applications/whph.desktop
runHook postInstall
'';
};
in
this