1{ lib
2, stdenv
3, fetchFromGitHub
4, installShellFiles
5}:
6
7stdenv.mkDerivation rec {
8 pname = "pyenv";
9 version = "2.3.32";
10
11 src = fetchFromGitHub {
12 owner = "pyenv";
13 repo = "pyenv";
14 rev = "refs/tags/v${version}";
15 hash = "sha256-miJ/WONNDieLryD2J9JmkmSCG5Iesg2N2GT/FI9NGY0=";
16 };
17
18 postPatch = ''
19 patchShebangs --build src/configure
20 '';
21
22 nativeBuildInputs = [
23 installShellFiles
24 ];
25
26 configureScript = "src/configure";
27
28 makeFlags = ["-C" "src"];
29
30 installPhase = ''
31 runHook preInstall
32
33 mkdir -p "$out"
34 cp -R bin "$out/bin"
35 cp -R libexec "$out/libexec"
36 cp -R plugins "$out/plugins"
37
38 runHook postInstall
39 '';
40
41 postInstall = ''
42 installManPage man/man1/pyenv.1
43 installShellCompletion completions/pyenv.{bash,fish,zsh}
44 '';
45
46 meta = with lib; {
47 description = "Simple Python version management";
48 homepage = "https://github.com/pyenv/pyenv";
49 changelog = "https://github.com/pyenv/pyenv/blob/${src.rev}/CHANGELOG.md";
50 license = licenses.mit;
51 maintainers = with maintainers; [ tjni ];
52 platforms = platforms.all;
53 mainProgram = "pyenv";
54 };
55}