summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/git-dummy/default.nix
blob: 2fffa2d6e06cc8011e58c0257a580a720d845635 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  installShellFiles,
  setuptools,
  gitpython,
  typer,
  pydantic-settings,
}:

buildPythonPackage rec {
  pname = "git-dummy";
  version = "0.1.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "initialcommit-com";
    repo = "git-dummy";
    rev = "v${version}";
    hash = "sha256-viybxn2J7SO7NgSvjwlP+tgtm+H6QrACafIy82d9XEk=";
  };

  build-system = [ setuptools ];

  dependencies = [
    gitpython
    typer
    pydantic-settings
  ];

  nativeBuildInputs = [ installShellFiles ];

  postInstall =
    # https://github.com/NixOS/nixpkgs/issues/308283
    lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
      installShellCompletion --cmd git-dummy \
        --bash <($out/bin/git-dummy --show-completion bash) \
        --fish <($out/bin/git-dummy --show-completion fish) \
        --zsh <($out/bin/git-dummy --show-completion zsh)
    '';

  meta = {
    homepage = "https://github.com/initialcommit-com/git-dummy";
    description = "Generate dummy Git repositories populated with the desired number of commits, branches, and structure";
    license = lib.licenses.gpl2Only;
    maintainers = with lib.maintainers; [ mathiassven ];
  };
}