Skip to content

Instantly share code, notes, and snippets.

@andyscott
Created November 30, 2023 23:28
Show Gist options
  • Save andyscott/7777a39708625c4dd3922ad53e1fa58d to your computer and use it in GitHub Desktop.
Save andyscott/7777a39708625c4dd3922ad53e1fa58d to your computer and use it in GitHub Desktop.
{ pkgs }:
with pkgs;
let
# copied directly from an old version of nixpkgs:
# https://github.com/NixOS/nixpkgs/blob/e8e39a55a0e0a4cbf6a76dfe914efa559f92aeaa/
# pkgs/development/tools/continuous-integration/fly/default.nix
original = buildGoModule rec {
pname = "fly";
version = "7.8.3";
src = fetchFromGitHub {
owner = "concourse";
repo = "concourse";
rev = "v${version}";
sha256 = "sha256-7r9/r6gj8u3r4R5UQIxpnmJ33SGfEAuOcqRLK11khfc=";
};
vendorSha256 = "sha256-tEh1D/eczqLzuVQUcHE4+7Q74jM/yomdPDt6+TVJeew=";
subPackages = [ "fly" ];
ldflags = [
"-s"
"-w"
"-X github.com/concourse/concourse.Version=${version}"
];
nativeBuildInputs = [ installShellFiles ];
doCheck = false;
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd fly \
--bash <($out/bin/fly completion --shell bash) \
--fish <($out/bin/fly completion --shell fish) \
--zsh <($out/bin/fly completion --shell zsh)
'';
meta = with lib; {
description = "Command line interface to Concourse CI";
homepage = "https://concourse-ci.org";
license = licenses.asl20;
maintainers = with maintainers; [ ivanbrennan SuperSandro2000 ];
};
};
in
# some tweaks, but we don't touch original so we can easily update it
# without having to make any manual adjustments.
pkgs.symlinkJoin {
name = "fly";
paths =
let
# the completion file doesn't autoload -- maybe this is a good
# upstream fix?
fixed_completions_file = (concatTextFile {
name = "_fly";
files = [
(writeText "fly-header" ''
#compdef fly
compdef _fly_compl fly
'')
"${original}/share/zsh/site-functions/_fly"
];
executable = true;
destination = "/share/zsh/site-functions/_fly";
});
in
[
fixed_completions_file
original
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment