blob: 49d7267220cfc12ab5f927a6b090e15a41948bdd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
{
lib,
buildGoModule,
callPackage,
findutils,
}:
let
source = callPackage ./source.nix { };
in
buildGoModule (finalAttrs: {
pname = "lima-additional-guestagents";
# Because agents must use the same version as lima, lima's updateScript should also update the shared src.
# nixpkgs-update: no auto update
inherit (source) version src vendorHash;
env.CGO_ENABLED = "0";
buildPhase =
let
makeFlags = [
"VERSION=v${finalAttrs.version}"
];
in
''
runHook preBuild
make ${lib.escapeShellArgs makeFlags} additional-guestagents
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r _output/* $out
runHook postInstall
'';
nativeInstallCheckInputs = [
findutils
];
doInstallCheck = true;
# Guest agents for the host's architecture are only in the "lima" package. So, we can't test this by running the binary.
installCheckPhase = ''
runHook preInstallCheck
[[ "$(find "$out/share" -type f -name 'lima-guestagent.Linux-*.gz' | wc -l)" -ge 5 ]]
runHook postInstallCheck
'';
meta = source.meta // {
description = "Lima Guest Agents for emulating non-native architectures";
longDescription = ''
This package should only be used when your guest's architecture differs from the host's.
To enable its functionality in `limactl`, set `withAdditionalGuestAgents = true` in the `lima` package:
```nix
pkgs.lima.override {
withAdditionalGuestAgents = true;
}
```
Typically, you won't need to directly add this package to your *.nix files.
'';
};
})
|