Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.03 67 lines 2.2 kB view raw
1{ stdenv, buildPythonPackage, fetchFromGitHub, fetchpatch, isPyPy, lib 2, psutil, setuptools, bottle, batinfo, pysnmp 3, hddtemp, future 4# Optional dependencies: 5, netifaces # IP module 6# Tests: 7, unittest2 8}: 9 10buildPythonPackage rec { 11 pname = "glances"; 12 version = "3.1.3"; 13 disabled = isPyPy; 14 15 src = fetchFromGitHub { 16 owner = "nicolargo"; 17 repo = "glances"; 18 rev = "v${version}"; 19 sha256 = "15yz8sbw3k3n0729g2zcwsxc5iyhkyrhqza6fnipxxpsskwgqbwp"; 20 }; 21 22 # Some tests fail in the sandbox (they e.g. require access to /sys/class/power_supply): 23 patches = lib.optional (doCheck && stdenv.isLinux) ./skip-failing-tests.patch 24 ++ [ 25 (fetchpatch { 26 # Correct unitest 27 url = "https://github.com/nicolargo/glances/commit/abf64ffde31113f5f46ef286703ff061fc57395f.patch"; 28 sha256 = "00krahqq89jvbgrqx2359cndmvq5maffhpj163z10s1n7q80kxp1"; 29 }) 30 31 (fetchpatch { 32 # Fix IP plugin initialization issue 33 url = "https://github.com/nicolargo/glances/commit/48cb5ef8053d823302e7e53490fb22cec2fabb0f.patch"; 34 sha256 = "1590qgcr8w3d9ddpgd9mk5j6q6aq29341vr8bi202yjwwiv2bia9"; 35 }) 36 ]; 37 38 # On Darwin this package segfaults due to mismatch of pure and impure 39 # CoreFoundation. This issues was solved for binaries but for interpreted 40 # scripts a workaround below is still required. 41 # Relevant: https://github.com/NixOS/nixpkgs/issues/24693 42 makeWrapperArgs = lib.optionals stdenv.isDarwin [ 43 "--set" "DYLD_FRAMEWORK_PATH" "/System/Library/Frameworks" 44 ]; 45 46 doCheck = true; 47 checkInputs = [ unittest2 ]; 48 preCheck = lib.optional stdenv.isDarwin '' 49 export DYLD_FRAMEWORK_PATH=/System/Library/Frameworks 50 ''; 51 52 propagatedBuildInputs = [ psutil setuptools bottle batinfo pysnmp future 53 netifaces 54 ] ++ lib.optional stdenv.isLinux hddtemp; 55 56 preConfigure = '' 57 sed -i 's/data_files\.append((conf_path/data_files.append(("etc\/glances"/' setup.py; 58 ''; 59 60 meta = with lib; { 61 homepage = https://nicolargo.github.io/glances/; 62 description = "Cross-platform curses-based monitoring tool"; 63 license = licenses.lgpl3; 64 maintainers = with maintainers; [ primeos koral ]; 65 platforms = platforms.linux ++ platforms.darwin; 66 }; 67}