From b1fb126f983ffea1daeee7673f709cc14040da09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sat, 20 Aug 2022 14:17:16 +0200 Subject: [PATCH] :rocket: enable bluetooth for desktop --- hosts/nixos-desktop/default.nix | 2 ++ modules/programs/bspwm/sxhkdrc | 8 +++++++ modules/programs/rofi/default.nix | 35 +++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/hosts/nixos-desktop/default.nix b/hosts/nixos-desktop/default.nix index a930f88..9a1fa86 100644 --- a/hosts/nixos-desktop/default.nix +++ b/hosts/nixos-desktop/default.nix @@ -89,6 +89,8 @@ environment.systemPackages = with pkgs; [ lm_sensors ]; boot.kernelModules = [ "lm92" "drivetemp" ]; + hardware.bluetooth.enable = true; + # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave diff --git a/modules/programs/bspwm/sxhkdrc b/modules/programs/bspwm/sxhkdrc index fa5d363..52f51f3 100755 --- a/modules/programs/bspwm/sxhkdrc +++ b/modules/programs/bspwm/sxhkdrc @@ -91,6 +91,14 @@ super + w super + c rofi -show calc -modi calc -no-show-match -no-sort | xclip -selection clipboard +# start rofi-bluetooth +super + b + rofi-bluetooth + +# start rofi-power-menu +super + p + rofi -show power-menu -modi power-menu:rofi-power-menu + # Show help super + h sxhkd-help diff --git a/modules/programs/rofi/default.nix b/modules/programs/rofi/default.nix index 77db271..1b4d4fc 100644 --- a/modules/programs/rofi/default.nix +++ b/modules/programs/rofi/default.nix @@ -7,6 +7,40 @@ with lib; let cfg = config.my.programs.rofi; + + rofi-bluetooth = with pkgs; stdenv.mkDerivation rec { + pname = "rofi-bluetooth"; + version = "unstable-2021-03-05"; + + src = fetchFromGitHub { + repo = pname; + owner = "nickclyde"; + # https://github.com/nickclyde/rofi-bluetooth/issues/19 + rev = "893db1f2b549e7bc0e9c62e7670314349a29cdf2"; + sha256 = "sha256-3oROJKEQCuSnLfbJ+JSSc9hcmJTPrLHRQJsrUcaOMss="; + }; + + nativeBuildInputs = [ makeWrapper ]; + + installPhase = '' + runHook preInstall + + install -D --target-directory=$out/bin/ ./rofi-bluetooth + + wrapProgram $out/bin/rofi-bluetooth \ + --prefix PATH ":" ${lib.makeBinPath [ rofi-unwrapped bluez ] } + + runHook postInstall + ''; + + meta = with lib; { + description = "Rofi-based interface to connect to bluetooth devices and display status info"; + homepage = "https://github.com/nickclyde/rofi-bluetooth"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ MoritzBoehme ]; + platforms = platforms.linux; + }; + }; in { options.my.programs.rofi = { @@ -27,6 +61,7 @@ in }; home.packages = with pkgs; [ (lib.mkIf config.networking.networkmanager.enable networkmanager_dmenu) + (lib.mkIf config.hardware.bluetooth.enable rofi-bluetooth) ]; xdg = { enable = true;