nixpkgs/pkgs/by-name/in/incus/generic.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

137 lines
2.3 KiB
Nix
Raw Normal View History

2024-02-01 04:09:57 +00:00
{
2024-03-19 03:02:30 +00:00
hash,
lts ? false,
2024-03-19 03:02:30 +00:00
patches,
updateScriptArgs ? "",
vendorHash,
version,
}:
2024-03-19 03:02:30 +00:00
{
callPackage,
2024-02-01 04:09:57 +00:00
lib,
buildGoModule,
fetchFromGitHub,
2024-03-19 03:02:30 +00:00
writeScript,
writeShellScript,
2024-02-01 04:09:57 +00:00
acl,
cowsql,
hwdata,
libcap,
lxc,
pkg-config,
sqlite,
udev,
installShellFiles,
nixosTests,
2023-08-29 14:51:14 +00:00
}:
let
2024-03-19 03:02:30 +00:00
pname = "incus${lib.optionalString lts "-lts"}";
in
buildGoModule rec {
inherit
patches
2024-03-19 03:02:30 +00:00
pname
vendorHash
2024-03-19 03:02:30 +00:00
version
;
2023-08-29 14:51:14 +00:00
src = fetchFromGitHub {
owner = "lxc";
repo = "incus";
2024-03-19 03:02:30 +00:00
rev = "refs/tags/v${version}";
inherit hash;
2023-08-29 14:51:14 +00:00
};
excludedPackages = [
# statically compile these
2023-08-29 14:51:14 +00:00
"cmd/incus-agent"
"cmd/incus-migrate"
# oidc test requires network
2023-11-27 13:26:13 +00:00
"test/mini-oidc"
2023-08-29 14:51:14 +00:00
];
nativeBuildInputs = [
installShellFiles
pkg-config
];
buildInputs = [
lxc
acl
libcap
cowsql.dev
sqlite
udev.dev
];
2024-02-01 04:09:57 +00:00
ldflags = [
"-s"
"-w"
];
2023-08-29 14:51:14 +00:00
tags = [ "libsqlite3" ];
2023-10-28 03:20:40 +00:00
# required for go-cowsql.
CGO_LDFLAGS_ALLOW = "(-Wl,-wrap,pthread_create)|(-Wl,-z,now)";
2023-08-29 14:51:14 +00:00
postBuild = ''
make incus-agent incus-migrate
'';
preCheck =
2024-02-01 04:09:57 +00:00
let
skippedTests = [
"TestValidateConfig"
"TestConvertNetworkConfig"
"TestConvertStorageConfig"
"TestSnapshotCommon"
"TestContainerTestSuite"
];
in
2023-08-29 14:51:14 +00:00
''
# Disable tests requiring local operations
buildFlagsArray+=("-run" "[^(${builtins.concatStringsSep "|" skippedTests})]")
'';
postInstall = ''
2024-01-03 13:46:27 +00:00
installShellCompletion --cmd incus \
2024-03-27 00:08:43 +00:00
--bash <($out/bin/incus completion bash) \
2024-01-03 13:46:27 +00:00
--fish <($out/bin/incus completion fish) \
--zsh <($out/bin/incus completion zsh)
2023-08-29 14:51:14 +00:00
'';
passthru = {
2024-03-19 03:02:30 +00:00
client = callPackage ./client.nix {
inherit
lts
meta
patches
src
vendorHash
version
;
};
tests = nixosTests.incus;
ui = callPackage ./ui.nix { };
updateScript = writeScript "ovs-update.nu" ''
${./update.nu} ${updateScriptArgs}
'';
2023-08-29 14:51:14 +00:00
};
meta = {
description = "Powerful system container and virtual machine manager";
homepage = "https://linuxcontainers.org/incus";
2024-01-29 22:01:20 +00:00
changelog = "https://github.com/lxc/incus/releases/tag/v${version}";
2023-08-29 14:51:14 +00:00
license = lib.licenses.asl20;
maintainers = lib.teams.lxc.members;
2023-08-29 14:51:14 +00:00
platforms = lib.platforms.linux;
2024-03-19 03:02:30 +00:00
mainProgram = "incus";
2023-08-29 14:51:14 +00:00
};
}