nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 stdenv,
6 testers,
7 earthly,
8}:
9
10buildGoModule rec {
11 pname = "earthly";
12 version = "0.8.16";
13
14 src = fetchFromGitHub {
15 owner = "earthly";
16 repo = "earthly";
17 rev = "v${version}";
18 hash = "sha256-2+Ya5i6V2QDzHsYR+Ro14u0VWR3wrQJHZRXBatGC8BA=";
19 };
20
21 vendorHash = "sha256-kEgg7zrT69X4yrsGtLyvnrGQ7+sXaEzdqd4Fz7rpFyg=";
22 subPackages = [
23 "cmd/earthly"
24 "cmd/debugger"
25 ];
26
27 env.CGO_ENABLED = 0;
28
29 ldflags = [
30 "-s"
31 "-w"
32 "-X main.Version=v${version}"
33 "-X main.DefaultBuildkitdImage=docker.io/earthly/buildkitd:v${version}"
34 "-X main.GitSha=v${version}"
35 "-X main.DefaultInstallationName=earthly"
36 ]
37 ++ lib.optionals stdenv.hostPlatform.isLinux [
38 "-extldflags '-static'"
39 ];
40
41 tags = [
42 "dfrunmount"
43 "dfrunnetwork"
44 "dfrunsecurity"
45 "dfsecrets"
46 "dfssh"
47 ];
48
49 postInstall = ''
50 mv $out/bin/debugger $out/bin/earthly-debugger
51 '';
52
53 passthru = {
54 tests.version = testers.testVersion {
55 package = earthly;
56 version = "v${version}";
57 };
58 };
59
60 meta = {
61 description = "Build automation for the container era";
62 homepage = "https://earthly.dev/";
63 changelog = "https://github.com/earthly/earthly/releases/tag/v${version}";
64 license = lib.licenses.mpl20;
65 maintainers = with lib.maintainers; [
66 zoedsoupe
67 konradmalik
68 ];
69 };
70}