1{ lib
2, stdenv
3, fetchFromGitHub
4, rustPlatform
5, installShellFiles
6, DiskArbitration
7, Foundation
8, Security
9}:
10
11rustPlatform.buildRustPackage rec {
12 pname = "fnm";
13 version = "1.33.1";
14
15 src = fetchFromGitHub {
16 owner = "Schniz";
17 repo = pname;
18 rev = "v${version}";
19 sha256 = "sha256-dwnPFbgfrc+1qF3u5Nm1KQu84UWK6H6VerSUaQacbRs=";
20 };
21
22 nativeBuildInputs = [ installShellFiles ];
23
24 buildInputs = lib.optionals stdenv.isDarwin [ DiskArbitration Foundation Security ];
25
26 cargoSha256 = "sha256-T88C5oYyVfepUw0cdNRhEwrvEI0t1gw/5qZL1E46pkY=";
27
28 doCheck = false;
29
30 postInstall = ''
31 installShellCompletion --cmd fnm \
32 --bash <($out/bin/fnm completions --shell bash) \
33 --fish <($out/bin/fnm completions --shell fish) \
34 --zsh <($out/bin/fnm completions --shell zsh)
35 '';
36
37 meta = with lib; {
38 description = "Fast and simple Node.js version manager";
39 homepage = "https://github.com/Schniz/fnm";
40 license = licenses.gpl3Only;
41 maintainers = with maintainers; [ kidonng ];
42 };
43}