Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 # Need macOS 15+ for nested virtualization.
5 apple-sdk_15,
6 buildGoModule,
7 fetchFromGitLab,
8 nix-update-script,
9 versionCheckHook,
10}:
11
12buildGoModule (finalAttrs: {
13 pname = "nesting";
14 version = "0.3.0";
15
16 src = fetchFromGitLab {
17 owner = "gitlab-org/fleeting";
18 repo = "nesting";
19 tag = "v${finalAttrs.version}";
20 hash = "sha256-ejoLld1TmwaqTlSyuzyEVEqLyEehu6g7yc0H0Cvkqp4=";
21 };
22
23 vendorHash = "sha256-CyXlK/0VWMFlwSfisoaNCRdknasp8faN/K/zdyRhAQQ=";
24
25 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_15 ];
26
27 # Needed for "nesting version" to not show "dev".
28 #
29 # https://gitlab.com/gitlab-org/fleeting/nesting/-/blob/v0.3.0/Makefile?ref_type=tags#L22-24
30 ldflags =
31 let
32 ldflagsPackageVariablePrefix = "gitlab.com/gitlab-org/fleeting/nesting";
33 in
34 [
35 "-X ${ldflagsPackageVariablePrefix}.NAME=nesting"
36 "-X ${ldflagsPackageVariablePrefix}.VERSION=${finalAttrs.version}"
37 "-X ${ldflagsPackageVariablePrefix}.REFERENCE=v${finalAttrs.version}"
38 ];
39
40 doInstallCheck = true;
41
42 nativeInstallCheckInputs = [ versionCheckHook ];
43
44 versionCheckProgramArg = "version";
45
46 passthru = {
47 updateScript = nix-update-script { };
48 };
49
50 meta = {
51 description = "Basic and opinionated daemon that sits in front of virtualization platforms";
52 homepage = "https://gitlab.com/gitlab-org/fleeting/nesting";
53 license = lib.licenses.mit;
54 mainProgram = "nesting";
55 maintainers = with lib.maintainers; [ commiterate ];
56 badPlatforms = [
57 # Only supports AArch64 for Darwin.
58 "x86_64-darwin"
59 ];
60 };
61})