Skip to content

Commit bbedb4d

Browse files
committed
add flake
1 parent 978bc96 commit bbedb4d

File tree

3 files changed

+171
-0
lines changed

3 files changed

+171
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
*.egg-info
44
build/
55
dist/
6+
result

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
{
2+
description = "Flake for obs-cli development and packaging";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs =
10+
{
11+
nixpkgs,
12+
flake-utils,
13+
...
14+
}:
15+
flake-utils.lib.eachDefaultSystem (
16+
system:
17+
let
18+
pkgs = import nixpkgs { inherit system; };
19+
python = pkgs.python312;
20+
pyPkgs = python.pkgs;
21+
22+
obswsPython = pyPkgs.buildPythonPackage rec {
23+
pname = "obsws-python";
24+
version = "1.6.2";
25+
pyproject = true;
26+
27+
src = pyPkgs.fetchPypi {
28+
pname = "obsws_python";
29+
inherit version;
30+
hash = "sha256-cR1gnZ5FxZ76SD9GlHSIhv142ejsqs/Bp8wV1A1kfdw=";
31+
};
32+
33+
nativeBuildInputs = [
34+
pyPkgs.hatchling
35+
];
36+
37+
propagatedBuildInputs = [
38+
pyPkgs.tomli
39+
pyPkgs.websocket-client
40+
];
41+
42+
doCheck = false;
43+
44+
meta = with pkgs.lib; {
45+
description = "Python SDK for OBS Studio WebSocket v5.0";
46+
homepage = "https://github.com/aatikturk/obsws-python";
47+
license = licenses.gpl3;
48+
maintainers = with maintainers; [ pschmitt ];
49+
};
50+
};
51+
52+
obsCli = pyPkgs.buildPythonApplication {
53+
pname = "obs-cli";
54+
version = "0.8.3";
55+
src = ./.;
56+
pyproject = true;
57+
nativeBuildInputs = with pyPkgs; [
58+
setuptools
59+
setuptools-scm
60+
wheel
61+
];
62+
propagatedBuildInputs = with pyPkgs; [
63+
obswsPython
64+
rich
65+
];
66+
pythonImportsCheck = [ "obs_cli" ];
67+
meta = with pkgs.lib; {
68+
description = "CLI for controlling OBS Studio";
69+
homepage = "https://github.com/pschmitt/obs-cli";
70+
license = licenses.gpl3Only;
71+
maintainers = with maintainers; [ pschmitt ];
72+
mainProgram = "obs-cli";
73+
};
74+
};
75+
76+
devTools = python.withPackages (
77+
ps: with ps; [
78+
black
79+
ipython
80+
neovim
81+
ruff
82+
]
83+
);
84+
in
85+
{
86+
packages = {
87+
default = obsCli;
88+
obs-cli = obsCli;
89+
obsws-python = obswsPython;
90+
};
91+
92+
devShells.default = pkgs.mkShell {
93+
name = "obs-cli-devshell";
94+
packages = [
95+
devTools
96+
pkgs.git
97+
pkgs.pre-commit
98+
pkgs.uv
99+
];
100+
shellHook = ''
101+
export PYTHONPATH="''${PWD}:''${PYTHONPATH:-}"
102+
export UV_PROJECT_ENVIRONMENT=".venv"
103+
echo "Entering obs-cli dev shell (Python ${python.version})."
104+
echo "Run 'uv sync' to populate .venv and 'obs-cli --help' to get started."
105+
'';
106+
};
107+
}
108+
);
109+
}

0 commit comments

Comments
 (0)