nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 62 lines 1.6 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchurl, 5}: 6let 7 inherit (stdenv.hostPlatform) system; 8 throwSystem = throw "Unsupported system: ${system}"; 9 10 systemToPlatform = { 11 "x86_64-linux" = { 12 name = "linux-amd64"; 13 hash = "sha256-bDAhFU18dliKlKY5WQVsVSMVyF4YeTaKO9pwheMcdcg="; 14 }; 15 "aarch64-linux" = { 16 name = "linux-arm64"; 17 hash = "sha256-uddWn2RxQyB9s7kx6FI/oH9L/7l/fMD/7HQXWDqvuyQ="; 18 }; 19 "x86_64-darwin" = { 20 name = "darwin-amd64"; 21 hash = "sha256-L+lCmI1ciYInCt5aTcSVRDW0IwecGZ2BZNKrpeEE4jo="; 22 }; 23 "aarch64-darwin" = { 24 name = "darwin-arm64"; 25 hash = "sha256-9ldVRUhHM2OD+BaOCqVmaE+HFP5jj+hrfyB6wobjS+E="; 26 }; 27 }; 28 platform = systemToPlatform.${system} or throwSystem; 29in 30stdenv.mkDerivation (finalAttrs: { 31 pname = "gh-copilot"; 32 version = "1.1.1"; 33 34 src = fetchurl { 35 name = "gh-copilot"; 36 url = "https://github.com/github/gh-copilot/releases/download/v${finalAttrs.version}/${platform.name}"; 37 hash = platform.hash; 38 }; 39 40 dontUnpack = true; 41 42 installPhase = '' 43 runHook preInstall 44 45 install -m755 -D $src $out/bin/gh-copilot 46 47 runHook postInstall 48 ''; 49 50 passthru.updateScript = ./update.sh; 51 52 meta = { 53 changelog = "https://github.com/github/gh-copilot/releases/tag/v${finalAttrs.version}"; 54 description = "Ask for assistance right in your terminal"; 55 homepage = "https://github.com/github/gh-copilot"; 56 license = lib.licenses.unfree; 57 mainProgram = "gh-copilot"; 58 maintainers = with lib.maintainers; [ perchun ]; 59 platforms = lib.attrNames systemToPlatform; 60 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 61 }; 62})