1{
2 fetchFromGitHub,
3 buildPythonPackage,
4 rustPlatform,
5 lib,
6 pillow,
7}:
8
9buildPythonPackage rec {
10 pname = "copykitten";
11 version = "1.2.3";
12 pyproject = true;
13
14 src = fetchFromGitHub {
15 owner = "Klavionik";
16 repo = "copykitten";
17 tag = "v${version}";
18 hash = "sha256-S4IPVhYk/o15LQK1AB8VpdrHwIwTZyvmI2+e27/vDLs=";
19 };
20
21 cargoDeps = rustPlatform.fetchCargoVendor {
22 inherit src;
23 hash = "sha256-kWhZzX/OI+05rvVFD+lOFvpKbNH/gMROFufcCzYDyko=";
24 };
25
26 build-system = [
27 rustPlatform.cargoSetupHook
28 rustPlatform.maturinBuildHook
29 ];
30
31 dependencies = [
32 pillow
33 ];
34
35 # The tests get/set the contents of the clipboard by running subprocesses.
36 # On Darwin, the tests try to use `pbcopy`/`pbpaste`, which aren't packaged in Nix.
37 # On Linux, I tried adding `xclip` to `nativeCheckInputs`, but got errors about
38 # displays being null and the clipboard never being initialized.
39 doCheck = false;
40
41 pythonImportsCheck = [ "copykitten" ];
42
43 meta = {
44 description = "Robust, dependency-free way to use the system clipboard in Python";
45 homepage = "https://github.com/Klavionik/copykitten";
46 changelog = "https://github.com/Klavionik/copykitten/blob/v${version}/CHANGELOG.md";
47 license = lib.licenses.mit;
48 maintainers = [ lib.maintainers.samasaur ];
49 platforms = lib.platforms.all;
50 };
51}