anyrun: switch to upstream flake for working daemon mode

Replace nixpkgs anyrun with the upstream anyrun-org/anyrun flake,
which provides its own HM module and plugin packages. The nixpkgs
build had a broken daemon (GTK activate crash). Re-enable daemon
startup and close/open toggle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-18 12:48:00 +01:00
parent 402f2f36f5
commit 9f2a5a2868
3 changed files with 113 additions and 11 deletions

View file

@ -2,6 +2,7 @@
{ config, pkgs, lib, inputs, ... }:
let
hyprland-pkgs = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system};
anyrun-pkgs = inputs.anyrun.packages.${pkgs.stdenv.hostPlatform.system};
isMacbook = config.networking.hostName == "FredOS-Macbook";
isGaming = !isMacbook;
@ -94,6 +95,15 @@ in
polkit_gnome
];
# Use upstream anyrun flake's HM module instead of the built-in one
# for working daemon mode.
home-manager.sharedModules = [
({ modulesPath, ... }: {
disabledModules = [ "${modulesPath}/programs/anyrun.nix" ];
})
inputs.anyrun.homeManagerModules.default
];
home-manager.users.fred = { config, lib, pkgs, inputs, ... }:
let
c = config.lib.stylix.colors;
@ -201,16 +211,20 @@ in
extraConfig =
let
powerMenu = pkgs.writeShellScript "power-menu" ''
# Standalone stdin mode conflicts with the daemon.
${anyrun-pkgs.anyrun}/bin/anyrun quit 2>/dev/null || true
choice=$(printf '%s\n' \
$'\uf023 Lock' \
$'\uf08b Logout' \
$'\uf01e Reboot' \
$'\uf011 Shutdown' \
| ${pkgs.anyrun}/bin/anyrun \
--plugins "${pkgs.anyrun}/lib/libstdin.so" \
| ${anyrun-pkgs.anyrun}/bin/anyrun \
--plugins "${anyrun-pkgs.stdin}/lib/libstdin.so" \
--show-results-immediately true \
--hide-plugin-info true \
--close-on-click true)
# Restart the daemon.
${anyrun-pkgs.anyrun}/bin/anyrun daemon &
case "$choice" in
*Lock) ${pkgs.hyprlock}/bin/hyprlock ;;
*Logout) hyprctl dispatch exit ;;
@ -261,6 +275,7 @@ in
hl.exec_cmd("wl-paste --type image --watch cliphist store")
hl.exec_cmd("hyprctl setcursor Bibata-Modern-Ice 24")
hl.exec_cmd("swayosd-server")
hl.exec_cmd("anyrun daemon")
${lib.optionalString isMacbook ''hl.exec_cmd("hypridle")''}
end)
@ -286,7 +301,7 @@ in
-- Apps
hl.bind(mod .. " + T", hl.dsp.exec_cmd("ghostty"))
hl.bind(mod .. " + E", hl.dsp.exec_cmd("nemo"))
hl.bind(mod .. " + R", hl.dsp.exec_cmd("killall anyrun || anyrun"))
hl.bind(mod .. " + R", hl.dsp.exec_cmd("anyrun close || anyrun"))
hl.bind(mod .. " + Q", hl.dsp.window.close())
hl.bind(mod .. " + SHIFT + E", hl.dsp.exit())
@ -305,8 +320,8 @@ in
hl.bind(mod .. " + K", hl.dsp.focus({ direction = "up" }))
hl.bind(mod .. " + J", hl.dsp.focus({ direction = "down" }))
-- Power menu toggle: kills anyrun if already open
hl.bind(mod .. " + L", hl.dsp.exec_cmd("killall anyrun || ${powerMenu}"))
-- Power menu dismiss launcher if open, then show menu
hl.bind(mod .. " + L", hl.dsp.exec_cmd("anyrun close 2>/dev/null; ${powerMenu}"))
-- Move windows
hl.bind(mod .. " + SHIFT + left", hl.dsp.window.move({ direction = "left" }))
@ -372,7 +387,7 @@ in
programs.anyrun = {
enable = true;
config = {
plugins = [ "${pkgs.anyrun}/lib/libapplications.so" ];
plugins = [ "${anyrun-pkgs.applications}/lib/libapplications.so" ];
x.fraction = 0.5;
y.fraction = 0.25;
width.absolute = 350;