nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPackages,
5 fetchFromGitHub,
6 buildGoModule,
7 nix-update-script,
8 installShellFiles,
9}:
10buildGoModule (finalAttrs: {
11 pname = "gh-classroom";
12 version = "0.1.14";
13
14 src = fetchFromGitHub {
15 owner = "github";
16 repo = "gh-classroom";
17 tag = "v${finalAttrs.version}";
18 hash = "sha256-h9j8B/MGZ4JJOJRj41IIQ9trQJZ4oqvT6ee9lc0P4oo=";
19 };
20
21 vendorHash = "sha256-UFV3KiRnefrdOwRsHQeo8mx8Z+sI1Rk5yu3jdZxUHxo=";
22
23 ldflags = [
24 "-s"
25 "-w"
26 "-X main.Version=${finalAttrs.version}"
27 ];
28
29 nativeBuildInputs = [ installShellFiles ];
30
31 postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (
32 let
33 emulator = stdenv.hostPlatform.emulator buildPackages;
34 in
35 ''
36 installShellCompletion --cmd gh-classroom \
37 --bash <(${emulator} $out/bin/gh-classroom --bash-completion) \
38 --fish <(${emulator} $out/bin/gh-classroom --fish-completion) \
39 --zsh <(${emulator} $out/bin/gh-classroom --zsh-completion)
40 ''
41 );
42
43 passthru.updateScript = nix-update-script { };
44
45 meta = {
46 homepage = "https://github.com/github/gh-classroom";
47 description = "Extension for the GitHub CLI, that enhances it for educators using GitHub classroom";
48 license = lib.licenses.mit;
49 maintainers = with lib.maintainers; [ _0x5a4 ];
50 mainProgram = "gh-classroom";
51 };
52})