Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 rustPlatform, 5 fetchFromGitHub, 6 installShellFiles, 7 buildPackages, 8 writableTmpDirAsHomeHook, 9 versionCheckHook, 10 nix-update-script, 11}: 12rustPlatform.buildRustPackage rec { 13 pname = "volta"; 14 version = "2.0.2"; 15 16 src = fetchFromGitHub { 17 owner = "volta-cli"; 18 repo = "volta"; 19 tag = "v${version}"; 20 hash = "sha256-ZI+3/Xbkg/JaZMLhrJEjaSwjs44fOaiRReM2DUTnkkc="; 21 }; 22 23 cargoHash = "sha256-xlqsubkaX2A6d5MIcGf9E0b11Gzneksgku0jvW+UdbE="; 24 25 buildInputs = [ installShellFiles ]; 26 27 postInstall = 28 let 29 emulator = stdenv.hostPlatform.emulator buildPackages; 30 in 31 '' 32 installShellCompletion --cmd volta \ 33 --bash <(${emulator} $out/bin/volta completions bash) \ 34 --fish <(${emulator} $out/bin/volta completions fish) \ 35 --zsh <(${emulator} $out/bin/volta completions zsh) 36 ''; 37 38 nativeCheckInputs = [ 39 writableTmpDirAsHomeHook 40 ]; 41 42 nativeInstallCheckInputs = [ 43 versionCheckHook 44 ]; 45 versionCheckProgramArg = "--version"; 46 # Tries to create /var/empty/.volta as $HOME is not writable 47 doInstallCheck = !stdenv.hostPlatform.isDarwin; 48 49 passthru = { 50 updateScript = nix-update-script { }; 51 }; 52 53 meta = { 54 description = "Hassle-Free JavaScript Tool Manager"; 55 longDescription = '' 56 With Volta, you can select a Node engine once and then stop worrying 57 about it. You can switch between projects and stop having to manually 58 switch between Nodes. You can install npm package binaries in your 59 toolchain without having to periodically reinstall them or figure out why 60 theyve stopped working. 61 62 Note: Volta cannot be used on NixOS out of the box because it downloads 63 Node binaries that assume shared libraries are in FHS standard locations. 64 ''; 65 homepage = "https://volta.sh/"; 66 changelog = "https://github.com/volta-cli/volta/blob/main/RELEASES.md"; 67 license = with lib.licenses; [ bsd2 ]; 68 maintainers = with lib.maintainers; [ fbrs ]; 69 mainProgram = "volta"; 70 }; 71}