nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 fetchFromGitHub,
3 gns3-server,
4 lib,
5 nixosTests,
6 pkgsStatic,
7 python3Packages,
8 stdenv,
9 testers,
10 util-linux,
11 writableTmpDirAsHomeHook,
12}:
13
14python3Packages.buildPythonApplication rec {
15 pname = "gns3-server";
16 version = "2.2.56";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "GNS3";
21 repo = "gns3-server";
22 tag = "v${version}";
23 hash = "sha256-akA6P/ONPioce4pJbg4wAzSvb7aSYGM8NfCs7q9svic=";
24 };
25
26 # GNS3 2.3.26 requires a static BusyBox for the Docker integration
27 prePatch = ''
28 cp ${pkgsStatic.busybox}/bin/busybox gns3server/compute/docker/resources/bin/busybox
29 '';
30
31 pythonRelaxDeps = [
32 "aiohttp"
33 "aiohttp-cors"
34 "jsonschema"
35 "platformdirs"
36 "sentry-sdk"
37 ];
38
39 build-system = with python3Packages; [ setuptools ];
40
41 dependencies = with python3Packages; [
42 aiofiles
43 aiohttp
44 aiohttp-cors
45 async-generator
46 async-timeout
47 distro
48 jinja2
49 jsonschema
50 multidict
51 platformdirs
52 prompt-toolkit
53 psutil
54 py-cpuinfo
55 sentry-sdk
56 truststore
57 yarl
58 ];
59
60 postInstall = lib.optionalString (!stdenv.hostPlatform.isWindows) ''
61 rm $out/bin/gns3loopback
62 '';
63
64 # util-linux (script program) is required for Docker support
65 makeWrapperArgs = [ "--suffix PATH : ${lib.makeBinPath [ util-linux ]}" ];
66
67 nativeCheckInputs = with python3Packages; [
68 pytest-aiohttp
69 pytest-rerunfailures
70 pytestCheckHook
71 writableTmpDirAsHomeHook
72 ];
73
74 pytestFlags = [
75 # Rerun failed tests up to three times (flaky tests)
76 "--reruns=3"
77 ];
78
79 disabledTestPaths = [
80 # fails on ofborg because of lack of cpu vendor information
81 "tests/controller/gns3vm/test_virtualbox_gns3_vm.py::test_cpu_vendor_id"
82 "tests/controller/test_project.py"
83 ];
84
85 passthru.tests = {
86 inherit (nixosTests) gns3-server;
87 version = testers.testVersion {
88 package = gns3-server;
89 command = "${lib.getExe gns3-server} --version";
90 };
91 };
92
93 meta = {
94 description = "Graphical Network Simulator 3 server";
95 longDescription = ''
96 The GNS3 server manages emulators such as Dynamips, VirtualBox or
97 Qemu/KVM. Clients like the GNS3 GUI control the server using a HTTP REST
98 API.
99 '';
100 homepage = "https://www.gns3.com/";
101 changelog = "https://github.com/GNS3/gns3-server/releases/tag/v${version}";
102 license = lib.licenses.gpl3Plus;
103 platforms = lib.platforms.linux;
104 maintainers = with lib.maintainers; [ anthonyroussel ];
105 mainProgram = "gns3server";
106 };
107}