Jafner.net/nix/dungeon-master/home-manager/python.nix
Joey Hafner b83b70cb23
Some checks are pending
SSH and echo to file / ssh (push) Waiting to run
Update flake, fix OBS issues, prune flatpaks, add unstable packages list, add Spotify config:
- Update flake to get most recent versions of librespot, spotify-player
- Add obs-toggle-recording script, wrap OBS with nixGL
- Prune flatpaks: Bottles, Chromium, Gnome Platform, Zoom, Kontact, Neochat
- Add unstable packages: librespot, fzf, deploy-rs
- Create librespot Systemd unit, enable spotify-player.
2024-10-23 15:33:37 -07:00

65 lines
2.4 KiB
Nix

{ pkgs, ... }:
{
home.packages = with pkgs; [
### Python script that uses OBS-Studio's websocket to toggle recording when a hotkey is pressed.
( writers.writePython3Bin "obs-toggle-recording" {
libraries = [
( python311Packages.buildPythonPackage {
pname = "obsws_python";
version = "1.7.0";
src = fetchurl {
url = "https://files.pythonhosted.org/packages/22/29/dcb5286c9301eee8b72aee1e997761fb2cca9bf963fcd373acdfca353af3/obsws_python-1.7.0-py3-none-any.whl";
sha256 = "0jvqfvqgvqjsv0jsddj51m4wrinbrc2gbymmnmv9kfarfj7ly7g7";
};
format = "wheel";
doCheck = false;
buildInputs = [];
checkInputs = [];
nativeBuildInputs = [];
propagatedBuildInputs = [
( python311Packages.buildPythonPackage {
pname = "tomli";
version = "2.0.2";
src = fetchurl {
url = "https://files.pythonhosted.org/packages/cf/db/ce8eda256fa131af12e0a76d481711abe4681b6923c27efb9a255c9e4594/tomli-2.0.2-py3-none-any.whl";
sha256 = "0f5ar8vfq7lkydj19am5ymxg11d00ql0kv5hj3v07lskbi429gif";
};
format = "wheel";
doCheck = false;
buildInputs = [];
checkInputs = [];
nativeBuildInputs = [];
propagatedBuildInputs = [];
} )
( python311Packages.buildPythonPackage {
pname = "websocket-client";
version = "1.8.0";
src = fetchurl {
url = "https://files.pythonhosted.org/packages/5a/84/44687a29792a70e111c5c477230a72c4b957d88d16141199bf9acb7537a3/websocket_client-1.8.0-py3-none-any.whl";
sha256 = "09m5pwwi4bbwdv2vdhlc5k0737kskhnxyb5j17l9ii7mjz4lrd0p";
};
format = "wheel";
doCheck = false;
buildInputs = [];
checkInputs = [];
nativeBuildInputs = [];
propagatedBuildInputs = [];
} )
];
} )
];
} ''
import obsws_python as obs
client = obs.ReqClient(host='localhost', port=4455)
recording_status = client.get_record_status()
active = recording_status.output_active
paused = recording_status.output_paused
if not active:
client.start_record()
else:
client.toggle_record_pause()
'' )
];
}