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