Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{ stdenv
, lib
, fetchFromGitHub
, substituteAll
, glib
, python3
, bluetooth_battery
, unstableGitUpdater
}:

stdenv.mkDerivation rec {
pname = "gnome-shell-extension-bluetooth-battery-indicator";
version = "unstable-2021-08-13";

src = fetchFromGitHub {
owner = "MichalW";
repo = "gnome-bluetooth-battery-indicator";
rev = "3b5e6b93e251058a99e3f258bceb2723166c085b";
sha256 = "ZHM3OAqXLKoh2IUXEtfBht8rfOgg259sXNelbmYTPSw=";
};

patches = [
# Make dependencies available at runtime.
(substituteAll {
src = ./fix-paths.patch;
bluetooth_battery = "${bluetooth_battery}/bin/bluetooth_battery";
python = python3.interpreter;
})
];

nativeBuildInputs = [
glib
];

buildPhase = ''
runHook preBuild

glib-compile-schemas --strict --targetdir=schemas schemas

runHook postBuild
'';

installPhase = ''
runHook preInstall

mkdir -p "$out/share/gnome-shell/extensions/${passthru.extensionUuid}"
cp -r *.js *.json schemas/ "$out/share/gnome-shell/extensions/${passthru.extensionUuid}"

runHook postInstall
'';

passthru = {
extensionUuid = "bluetooth-battery@michalw.github.com";
extensionPortalSlug = "bluetooth-battery";

updateScript = unstableGitUpdater {
# The updater tries src.url by default, which does not exist for fetchFromGitHub (fetchurl).
url = "${src.meta.homepage}.git";
};
};

meta = with lib; {
description = "GNOME Shell extension displaying battery percentage for bluetooth devices";
homepage = "https://github.com/MichalW/gnome-bluetooth-battery-indicator";
license = licenses.gpl3Only;
maintainers = with maintainers; [
jtojnar
];
platforms = platforms.linux;
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- a/constants.js
+++ b/constants.js
@@ -1,3 +1,3 @@
var GETTEXT_DOMAIN = 'bluetooth_battery_indicator';
var SETTINGS_ID = 'org.gnome.shell.extensions.bluetooth_battery_indicator';
-var SCRIPT_PATH = 'Bluetooth_Headset_Battery_Level/bluetooth_battery.py';
+var SCRIPT_PATH = '@bluetooth_battery@';
--- a/utils.js
+++ b/utils.js
@@ -36,6 +36,7 @@ function addSignalsHelperMethods(prototype) {
}

function getPythonExec() {
+ return '@python@';
//return ['python', 'python3', 'python2'].find(cmd => GLib.find_program_in_path(cmd));
return ['python3'].find(cmd => GLib.find_program_in_path(cmd)); //Hotfix for no percentage shown
}
1 change: 1 addition & 0 deletions pkgs/desktops/gnome/extensions/manuallyPackaged.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ callPackage }:
{
"arcmenu@arcmenu.com" = callPackage ./arcmenu { };
"bluetooth-battery@michalw.github.com" = callPackage ./bluetooth-battery-indicator { };
"caffeine@patapon.info" = callPackage ./caffeine { };
"clock-override@gnomeshell.kryogenix.org" = callPackage ./clock-override { };
"dash-to-dock@micxgx.gmail.com" = callPackage ./dash-to-dock { };
Expand Down