1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5
6 # nativeBuildInputs
7 installShellFiles,
8 pkg-config,
9
10 # buildInputs
11 openssl,
12 stdenv,
13
14 buildPackages,
15 versionCheckHook,
16
17 # passthru
18 nix-update-script,
19}:
20
21rustPlatform.buildRustPackage rec {
22 pname = "rye";
23 version = "0.44.0";
24
25 src = fetchFromGitHub {
26 owner = "mitsuhiko";
27 repo = "rye";
28 tag = version;
29 hash = "sha256-K9xad5Odza0Oxz49yMJjqpfh3cCgmWnbAlv069fHV6Q=";
30 };
31
32 cargoHash = "sha256-+gFa8hruXIweFm24XvfhqXZxNLAYKVNX+xBSCdAk54A=";
33
34 env = {
35 OPENSSL_NO_VENDOR = 1;
36 };
37
38 nativeBuildInputs = [
39 installShellFiles
40 pkg-config
41 ];
42
43 buildInputs = [
44 openssl
45 ];
46
47 postInstall =
48 let
49 emulator = stdenv.hostPlatform.emulator buildPackages;
50 in
51 ''
52 installShellCompletion --cmd rye \
53 --bash <(${emulator} $out/bin/rye self completion -s bash) \
54 --fish <(${emulator} $out/bin/rye self completion -s fish) \
55 --zsh <(${emulator} $out/bin/rye self completion -s zsh)
56 '';
57
58 checkFlags = [
59 "--skip=utils::test_is_inside_git_work_tree"
60
61 # The following require internet access to fetch a python binary
62 "--skip=test_add_and_sync_no_auto_sync"
63 "--skip=test_add_autosync"
64 "--skip=test_add_dev"
65 "--skip=test_add_explicit_version_or_url"
66 "--skip=test_add_flask"
67 "--skip=test_add_from_find_links"
68 "--skip=test_autosync_remember"
69 "--skip=test_basic_list"
70 "--skip=test_basic_script"
71 "--skip=test_basic_tool_behavior"
72 "--skip=test_config_empty"
73 "--skip=test_config_get_set_multiple"
74 "--skip=test_config_incompatible_format_and_show_path"
75 "--skip=test_config_save_missing_folder"
76 "--skip=test_config_show_path"
77 "--skip=test_dotenv"
78 "--skip=test_empty_sync"
79 "--skip=test_exclude_hashes"
80 "--skip=test_fetch"
81 "--skip=test_generate_hashes"
82 "--skip=test_init_default"
83 "--skip=test_init_lib"
84 "--skip=test_init_script"
85 "--skip=test_lint_and_format"
86 "--skip=test_list_never_overwrite"
87 "--skip=test_list_not_rye_managed"
88 "--skip=test_lockfile"
89 "--skip=test_publish_outside_project"
90 "--skip=test_version"
91 ];
92
93 nativeInstallCheckInputs = [
94 versionCheckHook
95 ];
96 versionCheckProgramArg = "--version";
97 doInstallCheck = true;
98
99 passthru = {
100 updateScript = nix-update-script { };
101 };
102
103 meta = {
104 description = "Tool to easily manage python dependencies and environments";
105 homepage = "https://github.com/mitsuhiko/rye";
106 changelog = "https://github.com/mitsuhiko/rye/releases/tag/${version}";
107 license = lib.licenses.mit;
108 maintainers = with lib.maintainers; [ GaetanLepage ];
109 mainProgram = "rye";
110 };
111}