Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ config 2, stdenv 3, lib 4, fetchFromGitHub 5, makeWrapper 6, makePerlPath 7 8# Perl libraries 9, LWP 10, LWPProtocolHttps 11, HTTPMessage 12, HTTPDate 13, URI 14, TryTiny 15 16# Required 17, coreutils 18, curl # Preferred to using the Perl HTTP libs - according to hw-probe. 19, dmidecode 20, edid-decode 21, gnugrep 22, gnutar 23, hwinfo 24, iproute2 25, kmod 26, pciutils 27, perl 28, smartmontools 29, usbutils 30, xz 31 32# Conditionally recommended 33, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd 34, systemd 35 36# Recommended 37, withRecommended ? true # Install recommended tools 38, mcelog 39, hdparm 40, acpica-tools 41, drm_info 42, mesa-demos 43, memtester 44, sysstat 45, cpuid 46, util-linuxMinimal 47, xinput 48, libva-utils 49, inxi 50, vulkan-tools 51, i2c-tools 52, opensc 53 54# Suggested 55, withSuggested ? false # Install (most) suggested tools 56, hplip 57, sane-backends 58# , pnputils # pnputils (lspnp) isn't currently in nixpkgs and appears to be poorly maintained 59}: 60 61stdenv.mkDerivation rec { 62 pname = "hw-probe"; 63 version = "1.6.5"; 64 65 src = fetchFromGitHub { 66 owner = "linuxhw"; 67 repo = pname; 68 rev = version; 69 sha256 = "sha256-WlLSgjVLqGGtwCyyUn9X3XbE2Yhz6LD245+U2JgGd+k="; 70 }; 71 72 makeFlags = [ "prefix=$(out)" ]; 73 74 nativeBuildInputs = [ makeWrapper ]; 75 76 buildInputs = [ perl ]; 77 78 makeWrapperArgs = 79 let 80 requiredPrograms = [ 81 hwinfo 82 dmidecode 83 smartmontools 84 pciutils 85 usbutils 86 edid-decode 87 iproute2 # (ip) 88 coreutils # (sort) 89 gnugrep 90 curl 91 gnutar 92 xz 93 kmod # (lsmod) 94 ]; 95 recommendedPrograms = [ 96 mcelog 97 hdparm 98 acpica-tools 99 drm_info 100 mesa-demos 101 memtester 102 sysstat # (iostat) 103 util-linuxMinimal # (rfkill) 104 xinput 105 libva-utils # (vainfo) 106 inxi 107 vulkan-tools 108 i2c-tools 109 opensc 110 ] 111 # cpuid is only compatible with i686 and x86_64 112 ++ lib.optional (lib.elem stdenv.hostPlatform.system cpuid.meta.platforms) cpuid; 113 conditionallyRecommendedPrograms = lib.optional systemdSupport systemd; # (systemd-analyze) 114 suggestedPrograms = [ 115 hplip # (hp-probe) 116 sane-backends # (sane-find-scanner) 117 # pnputils # (lspnp) 118 ]; 119 programs = 120 requiredPrograms 121 ++ conditionallyRecommendedPrograms 122 ++ lib.optionals withRecommended recommendedPrograms 123 ++ lib.optionals withSuggested suggestedPrograms; 124 in [ 125 "--set" "PERL5LIB" "${makePerlPath [ LWP LWPProtocolHttps HTTPMessage URI HTTPDate TryTiny ]}" 126 "--prefix" "PATH" ":" "${lib.makeBinPath programs}" 127 ]; 128 129 postInstall = '' 130 wrapProgram $out/bin/hw-probe \ 131 $makeWrapperArgs 132 ''; 133 134 meta = with lib; { 135 description = "Probe for hardware, check operability and find drivers"; 136 homepage = "https://github.com/linuxhw/hw-probe"; 137 platforms = with platforms; (linux ++ freebsd ++ netbsd ++ openbsd); 138 license = with licenses; [ lgpl21 bsdOriginal ]; 139 maintainers = with maintainers; [ rehno-lindeque ]; 140 }; 141}