Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 installShellFiles, 6 python312, 7 8 # Override Python packages using 9 # self: super: { pkg = super.pkg.overridePythonAttrs (oldAttrs: { ... }); } 10 # Applied after defaultOverrides 11 packageOverrides ? self: super: { }, 12}: 13let 14 defaultOverrides = [ 15 (self: super: { 16 av = ( 17 super.av.overridePythonAttrs rec { 18 version = "13.1.0"; 19 src = fetchFromGitHub { 20 owner = "PyAV-Org"; 21 repo = "PyAV"; 22 tag = "v${version}"; 23 hash = "sha256-x2a9SC4uRplC6p0cD7fZcepFpRidbr6JJEEOaGSWl60="; 24 }; 25 } 26 ); 27 }) 28 ]; 29 30 python = python312.override { 31 self = python; 32 packageOverrides = lib.composeManyExtensions (defaultOverrides ++ [ packageOverrides ]); 33 }; 34 35 version = "0.3.5"; 36in 37 38with python.pkgs; 39buildPythonApplication { 40 pname = "git-sim"; 41 inherit version; 42 pyproject = true; 43 44 src = fetchFromGitHub { 45 owner = "initialcommit-com"; 46 repo = "git-sim"; 47 rev = "v${version}"; 48 hash = "sha256-4jHkAlF2SAzHjBi8pmAJ0TKkcLxw+6EdGsXnHZUMILw="; 49 }; 50 51 patches = [ ./tests.patch ]; 52 53 build-system = [ setuptools ]; 54 55 pythonRemoveDeps = [ "opencv-python-headless" ]; 56 57 dependencies = [ 58 gitpython 59 manim 60 opencv4 61 typer 62 pydantic 63 fonttools 64 git-dummy 65 ]; 66 67 # https://github.com/NixOS/nixpkgs/commit/8033561015355dd3c3cf419d81ead31e534d2138 68 makeWrapperArgs = [ "--prefix PYTHONWARNINGS , ignore:::pydub.utils:" ]; 69 70 nativeBuildInputs = [ installShellFiles ]; 71 72 postInstall = 73 # https://github.com/NixOS/nixpkgs/issues/308283 74 lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 75 installShellCompletion --cmd git-sim \ 76 --bash <($out/bin/git-sim --show-completion bash) \ 77 --fish <($out/bin/git-sim --show-completion fish) \ 78 --zsh <($out/bin/git-sim --show-completion zsh) 79 '' 80 + "ln -s ${git-dummy}/bin/git-dummy $out/bin/"; 81 82 preCheck = '' 83 PATH=$PATH:$out/bin 84 ''; 85 86 nativeCheckInputs = [ 87 pytestCheckHook 88 git-dummy 89 ]; 90 91 doCheck = false; 92 93 meta = { 94 description = "Visually simulate Git operations in your own repos with a single terminal command"; 95 homepage = "https://initialcommit.com/tools/git-sim"; 96 license = lib.licenses.gpl2Only; 97 maintainers = with lib.maintainers; [ mathiassven ]; 98 }; 99}