2024-02-01 04:09:57 +00:00
|
|
|
{
|
2024-03-19 03:02:30 +00:00
|
|
|
hash,
|
2024-02-01 13:18:24 +00:00
|
|
|
lts ? false,
|
2024-03-19 03:02:30 +00:00
|
|
|
patches,
|
|
|
|
updateScriptArgs ? "",
|
|
|
|
vendorHash,
|
|
|
|
version,
|
|
|
|
}:
|
2024-02-01 13:18:24 +00:00
|
|
|
|
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,
|
2024-02-03 03:12:15 +00:00
|
|
|
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
|
|
|
}:
|
|
|
|
|
2024-02-01 13:18:24 +00:00
|
|
|
let
|
2024-03-19 03:02:30 +00:00
|
|
|
pname = "incus${lib.optionalString lts "-lts"}";
|
|
|
|
in
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
inherit
|
2024-02-24 18:11:18 +00:00
|
|
|
patches
|
2024-03-19 03:02:30 +00:00
|
|
|
pname
|
2024-02-24 18:11:18 +00:00
|
|
|
vendorHash
|
2024-03-19 03:02:30 +00:00
|
|
|
version
|
2024-02-24 18:11:18 +00:00
|
|
|
;
|
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}";
|
2024-02-01 13:18:24 +00:00
|
|
|
inherit hash;
|
2023-08-29 14:51:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
excludedPackages = [
|
2024-02-01 13:18:24 +00:00
|
|
|
# statically compile these
|
2023-08-29 14:51:14 +00:00
|
|
|
"cmd/incus-agent"
|
|
|
|
"cmd/incus-migrate"
|
2024-02-01 13:18:24 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
|
2024-01-07 10:10:58 +00:00
|
|
|
# Disable tests requiring local operations
|
|
|
|
checkFlags =
|
2024-02-01 04:09:57 +00:00
|
|
|
let
|
|
|
|
skippedTests = [
|
|
|
|
"TestValidateConfig"
|
|
|
|
"TestConvertNetworkConfig"
|
|
|
|
"TestConvertStorageConfig"
|
|
|
|
"TestSnapshotCommon"
|
|
|
|
"TestContainerTestSuite"
|
|
|
|
];
|
|
|
|
in
|
2024-01-07 10:10:58 +00:00
|
|
|
[ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
|
2023-08-29 14:51:14 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
;
|
|
|
|
};
|
|
|
|
|
2024-05-09 14:03:07 +00:00
|
|
|
tests = if lts then nixosTests.incus-lts else nixosTests.incus;
|
2024-03-19 03:02:30 +00:00
|
|
|
|
|
|
|
ui = callPackage ./ui.nix { };
|
|
|
|
|
|
|
|
updateScript = writeScript "ovs-update.nu" ''
|
|
|
|
${./update.nu} ${updateScriptArgs}
|
2024-02-03 03:12:15 +00:00
|
|
|
'';
|
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;
|
2023-12-02 14:38:44 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|