From e8334a04b216471ef31d091573c36c3f24f44a1d Mon Sep 17 00:00:00 2001 From: Kate Adkins Date: Tue, 22 Jul 2025 22:53:55 +0200 Subject: [PATCH] packages: add whph --- nixos/hosts/valere/default.nix | 21 +++++++- nixos/packages/default.pkgs.nix | 1 + nixos/packages/gui.pkgs.nix | 1 + packages/default.nix | 1 + packages/notion-app/default.nix | 36 +++++++------- packages/whph.nix | 88 +++++++++++++++++++++++++++++++++ 6 files changed, 128 insertions(+), 20 deletions(-) create mode 100644 packages/whph.nix diff --git a/nixos/hosts/valere/default.nix b/nixos/hosts/valere/default.nix index 5dd7884..d81cb47 100644 --- a/nixos/hosts/valere/default.nix +++ b/nixos/hosts/valere/default.nix @@ -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"; diff --git a/nixos/packages/default.pkgs.nix b/nixos/packages/default.pkgs.nix index 5990c36..50dc5d0 100644 --- a/nixos/packages/default.pkgs.nix +++ b/nixos/packages/default.pkgs.nix @@ -27,6 +27,7 @@ with pkgs; gnused gnugrep just + qrencode # Backup things. keepassxc diff --git a/nixos/packages/gui.pkgs.nix b/nixos/packages/gui.pkgs.nix index 70066f3..3231393 100644 --- a/nixos/packages/gui.pkgs.nix +++ b/nixos/packages/gui.pkgs.nix @@ -105,6 +105,7 @@ with pkgs; obsidian onboard supersonic + deprekages.whph # Development. jetbrains-toolbox diff --git a/packages/default.nix b/packages/default.nix index c04f1dc..7b793d4 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -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 { }; diff --git a/packages/notion-app/default.nix b/packages/notion-app/default.nix index 2bc0a66..a1567e2 100644 --- a/packages/notion-app/default.nix +++ b/packages/notion-app/default.nix @@ -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 = '' diff --git a/packages/whph.nix b/packages/whph.nix new file mode 100644 index 0000000..2625828 --- /dev/null +++ b/packages/whph.nix @@ -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