pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / by-name / lx / lxd-unwrapped-lts / package.nix
blob5b3f229d2fe060bc1db7b25fd08dceb73881b3db
2   lib,
3   hwdata,
4   pkg-config,
5   lxc,
6   buildGoModule,
7   fetchFromGitHub,
8   acl,
9   libcap,
10   dqlite,
11   raft-canonical,
12   sqlite,
13   udev,
14   installShellFiles,
15   nixosTests,
16   nix-update-script,
19 buildGoModule rec {
20   pname = "lxd-unwrapped-lts";
21   # major/minor are used in updateScript to pin to LTS
22   version = "5.21.2";
24   src = fetchFromGitHub {
25     owner = "canonical";
26     repo = "lxd";
27     rev = "refs/tags/lxd-${version}";
28     hash = "sha256-3C5pLvO7oABWFhFiWtBr5ohFFWm20Gg36WBfVVJgKdc=";
29   };
31   vendorHash = "sha256-W7+Z2o5cw3u0DbTZA+a3pRXt9zRggUUjFTUTtQ7B22A=";
33   postPatch = ''
34     substituteInPlace shared/usbid/load.go \
35       --replace "/usr/share/misc/usb.ids" "${hwdata}/share/hwdata/usb.ids"
36   '';
38   excludedPackages = [
39     "test"
40     "lxd/db/generate"
41     "lxd-agent"
42     "lxd-migrate"
43   ];
45   nativeBuildInputs = [
46     installShellFiles
47     pkg-config
48   ];
49   buildInputs = [
50     lxc
51     acl
52     libcap
53     dqlite.dev
54     raft-canonical.dev
55     sqlite
56     udev.dev
57   ];
59   ldflags = [
60     "-s"
61     "-w"
62   ];
63   tags = [ "libsqlite3" ];
65   preBuild = ''
66     # required for go-dqlite. See: https://github.com/canonical/lxd/pull/8939
67     export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"
68   '';
70   # build static binaries: https://github.com/canonical/lxd/blob/6fd175c45e65cd475d198db69d6528e489733e19/Makefile#L43-L51
71   postBuild = ''
72     make lxd-agent lxd-migrate
73   '';
75   checkFlags =
76     let
77       skippedTests = [
78         "TestValidateConfig"
79         "TestConvertNetworkConfig"
80         "TestConvertStorageConfig"
81         "TestSnapshotCommon"
82         "TestContainerTestSuite"
83       ];
84     in
85     [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
87   postInstall = ''
88     installShellCompletion --bash --name lxd ./scripts/bash/lxd-client
89   '';
91   passthru = {
92     tests.lxd = nixosTests.lxd;
93     tests.lxd-to-incus = nixosTests.incus.lxd-to-incus;
95     updateScript = nix-update-script {
96       extraArgs = [
97         "--version-regex"
98         "lxd-(5.21.*)"
99       ];
100     };
101   };
103   meta = with lib; {
104     description = "Daemon based on liblxc offering a REST API to manage containers";
105     homepage = "https://ubuntu.com/lxd";
106     changelog = "https://github.com/canonical/lxd/releases/tag/lxd-${version}";
107     license = with licenses; [
108       asl20
109       agpl3Plus
110     ];
111     maintainers = [ ];
112     platforms = platforms.linux;
113   };