This commit is contained in:
fwastring 2025-10-12 14:14:42 +02:00
commit 451181b9fa
4 changed files with 219 additions and 0 deletions

79
flake.nix Normal file
View file

@ -0,0 +1,79 @@
{
description = "GTK controls wrapper for playerctl";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
let
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs systems;
in {
packages = forAllSystems (system:
let
pkgs = import nixpkgs { inherit system; };
pythonPath = pkgs.python3Packages.makePythonPath ([ pkgs.python3Packages.pygobject3 ]);
in {
default = pkgs.stdenv.mkDerivation {
pname = "playerctl-gtk";
version = "0.1.0";
src = self;
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [
pkgs.wrapGAppsHook
pkgs.python3
];
buildInputs = [
pkgs.python3Packages.pygobject3
pkgs.playerctl
pkgs.gtk3
pkgs.gsettings-desktop-schemas
pkgs.adwaita-icon-theme
pkgs.gobject-introspection
];
installPhase = ''
runHook preInstall
install -Dm755 playerctl_gui.py $out/bin/playerctl-gtk
patchShebangs $out/bin/playerctl-gtk
runHook postInstall
'';
preFixup = ''
gappsWrapperArgs+=(--prefix PYTHONPATH : "${pythonPath}")
gappsWrapperArgs+=(--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.playerctl ]})
'';
};
});
apps = forAllSystems (system:
let
pkg = self.packages.${system}.default;
in {
default = {
type = "app";
program = "${pkg}/bin/playerctl-gtk";
};
});
devShells = forAllSystems (system:
let
pkgs = import nixpkgs { inherit system; };
in {
default = pkgs.mkShell {
buildInputs = [
pkgs.python3
pkgs.python3Packages.pygobject3
pkgs.playerctl
pkgs.gtk3
pkgs.gobject-introspection
];
};
});
};
}