nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildGoModule,
6 installShellFiles,
7 versionCheckHook,
8}:
9
10buildGoModule (finalAttrs: {
11 pname = "dockerfmt";
12 version = "0.3.9";
13
14 src = fetchFromGitHub {
15 owner = "reteps";
16 repo = "dockerfmt";
17 tag = "v${finalAttrs.version}";
18 hash = "sha256-eTsYL2UAVW2M1aQGc5X1gT5cXpXKgshLmN+U5Qro/Qw=";
19 };
20
21 vendorHash = "sha256-fLGgvAxSAiVSrsnF7r7EpPKCOOD9jzUsXxVQNWjYq80=";
22
23 nativeBuildInputs = [ installShellFiles ];
24 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
25 installShellCompletion --cmd dockerfmt \
26 --bash <($out/bin/dockerfmt completion bash) \
27 --fish <($out/bin/dockerfmt completion fish) \
28 --zsh <($out/bin/dockerfmt completion zsh)
29 '';
30
31 doInstallCheck = true;
32 nativeInstallCheckInputs = [ versionCheckHook ];
33 versionCheckProgramArg = "version";
34
35 meta = {
36 description = "Dockerfile formatter: a modern dockfmt";
37 homepage = "https://github.com/reteps/dockerfmt";
38 license = lib.licenses.mit;
39 maintainers = with lib.maintainers; [ mahyarmirrashed ];
40 mainProgram = "dockerfmt";
41 };
42})