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