From 5d583db5a236c346b9c47b1a35f7f1c1c7b3b933 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Apr 2020 23:04:04 +0200 Subject: [PATCH 01/14] Remove Nix 1.x --- pkgs/tools/package-management/nix/default.nix | 39 +++++-------------- pkgs/top-level/all-packages.nix | 1 - 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix index 29af4a90cb9..ea56940bc47 100644 --- a/pkgs/tools/package-management/nix/default.nix +++ b/pkgs/tools/package-management/nix/default.nix @@ -20,7 +20,7 @@ common = , withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp , withAWS ? stdenv.isLinux || stdenv.isDarwin, aws-sdk-cpp - , name, suffix ? "", src, includesPerl ? false + , name, suffix ? "", src }: let @@ -29,7 +29,6 @@ common = inherit name src; version = lib.getVersion name; - is20 = lib.versionAtLeast version "2.0pre"; is24 = lib.versionAtLeast version "2.4pre"; isExactly23 = lib.versionAtLeast version "2.3" && lib.versionOlder version "2.4"; @@ -39,15 +38,16 @@ common = nativeBuildInputs = [ pkgconfig ] - ++ lib.optionals (!is20) [ curl perl ] ++ lib.optionals is24 [ jq ]; - buildInputs = [ curl openssl sqlite xz bzip2 nlohmann_json ] + buildInputs = + [ curl openssl sqlite xz bzip2 nlohmann_json + brotli boost editline + ] ++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium - ++ lib.optionals is20 [ brotli boost editline ] ++ lib.optionals is24 [ libarchive rustc cargo ] ++ lib.optional withLibseccomp libseccomp - ++ lib.optional (withAWS && is20) + ++ lib.optional withAWS ((aws-sdk-cpp.override { apis = ["s3" "transfer"]; customMemoryManagement = false; @@ -66,7 +66,7 @@ common = preConfigure = # Copy libboost_context so we don't get all of Boost in our closure. # https://github.com/NixOS/nixpkgs/issues/45462 - lib.optionalString is20 '' + '' mkdir -p $out/lib cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib rm -f $out/lib/*.a @@ -97,12 +97,7 @@ common = "--disable-init-state" "--enable-gc" ] - ++ lib.optionals (!is20) [ - "--with-dbi=${perlPackages.DBI}/${perl.libPrefix}" - "--with-dbd-sqlite=${perlPackages.DBDSQLite}/${perl.libPrefix}" - "--with-www-curl=${perlPackages.WWWCurl}/${perl.libPrefix}" - "BDW_GC_LIBS=\"-lgc -lgccpp\"" - ] ++ lib.optionals (is20 && stdenv.isLinux) [ + ++ lib.optionals stdenv.isLinux [ "--with-sandbox-shell=${sh}/bin/busybox" ] ++ lib.optional ( @@ -143,7 +138,7 @@ common = }; passthru = { - perl-bindings = if includesPerl then nix else stdenv.mkDerivation { + perl-bindings = stdenv.mkDerivation { pname = "nix-perl"; inherit version; @@ -154,8 +149,7 @@ common = # This is not cross-compile safe, don't have time to fix right now # but noting for future travellers. nativeBuildInputs = - [ perl pkgconfig curl nix libsodium ] - ++ lib.optional is20 boost; + [ perl pkgconfig curl nix libsodium boost ]; configureFlags = [ "--with-dbi=${perlPackages.DBI}/${perl.libPrefix}" @@ -174,19 +168,6 @@ in rec { nix = nixStable; - nix1 = callPackage common rec { - name = "nix-1.11.16"; - src = fetchurl { - url = "http://nixos.org/releases/nix/${name}/${name}.tar.xz"; - sha256 = "0ca5782fc37d62238d13a620a7b4bff6a200bab1bd63003709249a776162357c"; - }; - - # Nix1 has the perl bindings by default, so no need to build the manually. - includesPerl = true; - - inherit storeDir stateDir confDir boehmgc; - }; - nixStable = callPackage common (rec { name = "nix-2.3.3"; src = fetchurl { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 954b0246da2..d3e8cbd1642 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25383,7 +25383,6 @@ in boehmgc = boehmgc.override { enableLargeConfig = true; }; }) nix - nix1 nixStable nixUnstable nixFlakes; From b23f697b0000403091ffe02bd03e842021afa690 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Apr 2020 23:29:31 +0200 Subject: [PATCH 02/14] nix: 2.4pre7250_94c93437 -> 2.4pre7346_5e7ccdc9, 2.4pre20200220_4a4521f -> 2.4pre20200403_3473b19 --- pkgs/tools/package-management/nix/default.nix | 46 ++++++++++++++----- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix index ea56940bc47..8260f2e83c3 100644 --- a/pkgs/tools/package-management/nix/default.nix +++ b/pkgs/tools/package-management/nix/default.nix @@ -1,4 +1,4 @@ -{ lib, fetchurl, callPackage +{ lib, fetchurl, fetchFromGitHub, callPackage , storeDir ? "/nix/store" , stateDir ? "/nix/var" , confDir ? "/etc" @@ -12,6 +12,7 @@ common = { lib, stdenv, fetchpatch, perl, curl, bzip2, sqlite, openssl ? null, xz , bash, coreutils, gzip, gnutar , pkgconfig, boehmgc, perlPackages, libsodium, brotli, boost, editline, nlohmann_json + , autoreconfHook, autoconf-archive, bison, flex, libxml2, libxslt, docbook5, docbook_xsl_ns , jq, libarchive, rustc, cargo , busybox-sandbox-shell , storeDir @@ -20,7 +21,7 @@ common = , withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp , withAWS ? stdenv.isLinux || stdenv.isDarwin, aws-sdk-cpp - , name, suffix ? "", src + , name, suffix ? "", src, crates ? null }: let @@ -38,7 +39,7 @@ common = nativeBuildInputs = [ pkgconfig ] - ++ lib.optionals is24 [ jq ]; + ++ lib.optionals is24 [ autoreconfHook autoconf-archive bison flex libxml2 libxslt docbook5 docbook_xsl_ns jq ]; buildInputs = [ curl openssl sqlite xz bzip2 nlohmann_json @@ -75,6 +76,11 @@ common = patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.* ''} '' + + # Unpack the Rust crates. + lib.optionalString is24 '' + tar xvf ${crates} -C nix-rust/ + mv nix-rust/nix-vendored-crates* nix-rust/vendor + '' + # For Nix-2.3, patch around an issue where the Nix configure step pulls in the # build system's bash and other utilities when cross-compiling lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform && isExactly23) '' @@ -149,7 +155,7 @@ common = # This is not cross-compile safe, don't have time to fix right now # but noting for future travellers. nativeBuildInputs = - [ perl pkgconfig curl nix libsodium boost ]; + [ perl pkgconfig curl nix libsodium boost autoreconfHook autoconf-archive ]; configureFlags = [ "--with-dbi=${perlPackages.DBI}/${perl.libPrefix}" @@ -182,10 +188,18 @@ in rec { nixUnstable = lib.lowPrio (callPackage common rec { name = "nix-2.4${suffix}"; - suffix = "pre7250_94c93437"; - src = fetchurl { - url = "https://hydra.nixos.org/build/112193977/download/3/nix-2.4${suffix}.tar.xz"; - sha256 = "f9baf241c9449c1e3e5c9610adbcd2ce9e5fbcab16aff3ba3030d2fad7b34d7b"; + suffix = "pre7346_5e7ccdc9"; + + src = fetchFromGitHub { + owner = "NixOS"; + repo = "nix"; + rev = "5e7ccdc9e3ddd61dc85e20c898001345bfb497a5"; + sha256 = "10jg0rq92xbigbbri7harn4b75blqaf6rjgq4hhvlnggf2w9iprg"; + }; + + crates = fetchurl { + url = https://hydra.nixos.org/build/115942497/download/1/nix-vendored-crates-2.4pre20200403_3473b19.tar.xz; + sha256 = "a83785553bb4bc5b28220562153e201ec555a00171466ac08b716f0c97aee45a"; }; inherit storeDir stateDir confDir boehmgc; @@ -193,10 +207,18 @@ in rec { nixFlakes = lib.lowPrio (callPackage common rec { name = "nix-2.4${suffix}"; - suffix = "pre20200220_4a4521f"; - src = fetchurl { - url = "https://hydra.nixos.org/build/113373394/download/3/nix-2.4${suffix}.tar.xz"; - sha256 = "31fe87c40f40a590bc8f575283725d5f04ecb9aebb6b404f679d77438d75265d"; + suffix = "pre20200403_3473b19"; + + src = fetchFromGitHub { + owner = "NixOS"; + repo = "nix"; + rev = "3473b1950a90d596a3baa080fdfdb080f55a5cc0"; + sha256 = "1bb7a8a5lzmb3pzq80zxd3s9y3qv757q7032s5wvp75la9wgvmvr"; + }; + + crates = fetchurl { + url = https://hydra.nixos.org/build/115942497/download/1/nix-vendored-crates-2.4pre20200403_3473b19.tar.xz; + sha256 = "a83785553bb4bc5b28220562153e201ec555a00171466ac08b716f0c97aee45a"; }; inherit storeDir stateDir confDir boehmgc; From 0b6ba28190d6942da89b89f7597c60b58a01bf2b Mon Sep 17 00:00:00 2001 From: "R. RyanTM" Date: Sun, 5 Apr 2020 05:42:23 +0000 Subject: [PATCH 03/14] shadowenv: 1.3.1 -> 1.3.2 --- pkgs/tools/misc/shadowenv/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/misc/shadowenv/default.nix b/pkgs/tools/misc/shadowenv/default.nix index 71cb3d23beb..fd090767a30 100644 --- a/pkgs/tools/misc/shadowenv/default.nix +++ b/pkgs/tools/misc/shadowenv/default.nix @@ -2,16 +2,16 @@ rustPlatform.buildRustPackage rec { pname = "shadowenv"; - version = "1.3.1"; + version = "1.3.2"; src = fetchFromGitHub { owner = "Shopify"; repo = pname; rev = version; - sha256 = "1s59ra99wcyyqz8gzly4qmcq5rh22c50c75cdi2kyajm7ghgryy9"; + sha256 = "1yapplqy7wmmjh8r5m43na9n2p100k80s7nkaswndyp5ljr9m20l"; }; - cargoSha256 = "1nqzg5jnwvf6wiihi3wwrym3d6g0hsfaxcadhl95r3v4k35fn5qb"; + cargoSha256 = "1pnfd461i65jd7s8dpfpys4k620w86bv56gkdsyx5lcvhqw1krnr"; buildInputs = stdenv.lib.optionals stdenv.isDarwin [ Security ]; From b68894b2cfb34daba6f6a8c6eee78986a6a50278 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 9 Mar 2020 14:06:14 +0200 Subject: [PATCH 04/14] uhd: 3.14.0.0 -> 3.15.0.0 Use rec instead of let in and use only 1 version attribute. --- pkgs/applications/radio/uhd/default.nix | 26 ++++++++++--------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/pkgs/applications/radio/uhd/default.nix b/pkgs/applications/radio/uhd/default.nix index 76519062f59..bf85ac51291 100644 --- a/pkgs/applications/radio/uhd/default.nix +++ b/pkgs/applications/radio/uhd/default.nix @@ -7,28 +7,22 @@ # SUBSYSTEMS=="usb", ATTRS{idVendor}=="fffe", ATTRS{idProduct}=="0002", MODE:="0666" # SUBSYSTEMS=="usb", ATTRS{idVendor}=="2500", ATTRS{idProduct}=="0002", MODE:="0666" -let - uhdVer = "v" + version; - +stdenv.mkDerivation rec { + pname = "uhd"; # UHD seems to use three different version number styles: x.y.z, xxx_yyy_zzz # and xxx.yyy.zzz. Hrmpf... style keeps changing - version = "3.14.0.0"; - - # Firmware images are downloaded (pre-built) from the respective release on Github - uhdImagesSrc = fetchurl { - url = "https://github.com/EttusResearch/uhd/releases/download/${uhdVer}/uhd-images_${version}.tar.xz"; - sha256 = "1fp37wgqkbr14cxg9l7ghfd4r92y2bxwgb7cfjzs96hbpd9s6al0"; - }; - -in stdenv.mkDerivation { - pname = "uhd"; - inherit version; + version = "3.15.0.0"; src = fetchFromGitHub { owner = "EttusResearch"; repo = "uhd"; - rev = uhdVer; - sha256 = "0y1hff4vslfv36vxgvjqajg4862a11d4wgr0vcb0visgh1bi8qgy"; + rev = "v${version}"; + sha256 = "0jknln88a69fh244670nb7qrflbyv0vvdxfddb5g8ncpb6hcg8qf"; + }; + # Firmware images are downloaded (pre-built) from the respective release on Github + uhdImagesSrc = fetchurl { + url = "https://github.com/EttusResearch/uhd/releases/download/v${version}/uhd-images_${version}.tar.xz"; + sha256 = "1fir1a13ac07mqhm4sr34cixiqj2difxq0870qv1wr7a7cbfw6vp"; }; enableParallelBuilding = true; From 7bbed32888aa4aaa9f04c6dc52cb8fc04fc85c12 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 9 Mar 2020 14:16:25 +0200 Subject: [PATCH 05/14] uhd: format arguments and inputs --- pkgs/applications/radio/uhd/default.nix | 29 ++++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/radio/uhd/default.nix b/pkgs/applications/radio/uhd/default.nix index bf85ac51291..76726012b68 100644 --- a/pkgs/applications/radio/uhd/default.nix +++ b/pkgs/applications/radio/uhd/default.nix @@ -1,5 +1,13 @@ -{ stdenv, fetchurl, fetchFromGitHub, cmake, pkgconfig -, python, orc, libusb1, boost }: +{ stdenv +, fetchurl +, fetchFromGitHub +, cmake +, pkgconfig +, python +, orc +, libusb1 +, boost +}: # You need these udev rules to not have to run as root (copied from # ${uhd}/share/uhd/utils/uhd-usrp.rules): @@ -27,13 +35,18 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - # ABI differences GCC 7.1 - # /nix/store/wd6r25miqbk9ia53pp669gn4wrg9n9cj-gcc-7.3.0/include/c++/7.3.0/bits/vector.tcc:394:7: note: parameter passing for argument of type 'std::vector::iterator {aka __gnu_cxx::__normal_iterator >}' changed in GCC 7.1 + cmakeFlags = [ + "-DLIBUSB_INCLUDE_DIRS=${libusb1.dev}/include/libusb-1.0" + ] + # ABI differences GCC 7.1 + # /nix/store/wd6r25miqbk9ia53pp669gn4wrg9n9cj-gcc-7.3.0/include/c++/7.3.0/bits/vector.tcc:394:7: note: parameter passing for argument of type 'std::vector::iterator {aka __gnu_cxx::__normal_iterator >}' changed in GCC 7.1 + ++ [ (stdenv.lib.optionalString stdenv.isAarch32 "-DCMAKE_CXX_FLAGS=-Wno-psabi") ] + ; - cmakeFlags = [ "-DLIBUSB_INCLUDE_DIRS=${libusb1.dev}/include/libusb-1.0"] ++ - [ (stdenv.lib.optionalString stdenv.isAarch32 "-DCMAKE_CXX_FLAGS=-Wno-psabi") ]; - - nativeBuildInputs = [ cmake pkgconfig ]; + nativeBuildInputs = [ + cmake + pkgconfig + ]; buildInputs = [ (python.withPackages (ps: with ps; [ Mako six requests ])) orc From 6dc7131d26fe8bf4625f9fab1855a08d3c64f9e0 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 9 Mar 2020 14:31:30 +0200 Subject: [PATCH 06/14] uhd: remove and add TODO for old build fixes --- pkgs/applications/radio/uhd/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/radio/uhd/default.nix b/pkgs/applications/radio/uhd/default.nix index 76726012b68..d289e7e3c71 100644 --- a/pkgs/applications/radio/uhd/default.nix +++ b/pkgs/applications/radio/uhd/default.nix @@ -36,8 +36,8 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; cmakeFlags = [ - "-DLIBUSB_INCLUDE_DIRS=${libusb1.dev}/include/libusb-1.0" ] + # TODO: Check if this still needed # ABI differences GCC 7.1 # /nix/store/wd6r25miqbk9ia53pp669gn4wrg9n9cj-gcc-7.3.0/include/c++/7.3.0/bits/vector.tcc:394:7: note: parameter passing for argument of type 'std::vector::iterator {aka __gnu_cxx::__normal_iterator >}' changed in GCC 7.1 ++ [ (stdenv.lib.optionalString stdenv.isAarch32 "-DCMAKE_CXX_FLAGS=-Wno-psabi") ] @@ -56,6 +56,8 @@ stdenv.mkDerivation rec { # Build only the host software preConfigure = "cd host"; + # TODO: Check if this still needed, perhaps relevant: + # https://files.ettus.com/manual_archive/v3.15.0.0/html/page_build_guide.html#build_instructions_unix_arm patches = if stdenv.isAarch32 then ./neon.patch else null; postPhases = [ "installFirmware" ]; From 9723ccbc343fa631d3fc0871238b6b75944b1cf1 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 9 Mar 2020 15:41:01 +0200 Subject: [PATCH 07/14] uhd: Remove orc unneeded dep --- pkgs/applications/radio/uhd/default.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/applications/radio/uhd/default.nix b/pkgs/applications/radio/uhd/default.nix index d289e7e3c71..1fcb0e28031 100644 --- a/pkgs/applications/radio/uhd/default.nix +++ b/pkgs/applications/radio/uhd/default.nix @@ -4,7 +4,6 @@ , cmake , pkgconfig , python -, orc , libusb1 , boost }: @@ -49,7 +48,6 @@ stdenv.mkDerivation rec { ]; buildInputs = [ (python.withPackages (ps: with ps; [ Mako six requests ])) - orc libusb1 boost ]; From fd2c3ff812f9a36ed83cb5569d6e2d1dc33b8e2a Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 9 Mar 2020 15:41:35 +0200 Subject: [PATCH 08/14] uhd: Remove python six and requests unneeded deps (tested) --- pkgs/applications/radio/uhd/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/radio/uhd/default.nix b/pkgs/applications/radio/uhd/default.nix index 1fcb0e28031..ffc28c3480f 100644 --- a/pkgs/applications/radio/uhd/default.nix +++ b/pkgs/applications/radio/uhd/default.nix @@ -45,9 +45,10 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake pkgconfig + # Python + Mako are always required for the build itself but not necessary for runtime + (python.withPackages (ps: with ps; [ Mako ])) ]; buildInputs = [ - (python.withPackages (ps: with ps; [ Mako six requests ])) libusb1 boost ]; From bcf5a67e2a4aea8a8d58f666b36430b8f74b6de1 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 9 Mar 2020 17:21:20 +0200 Subject: [PATCH 09/14] uhd: cleanup deps & add many enable / disable flags --- pkgs/applications/radio/uhd/default.nix | 89 ++++++++++++++++++++++--- 1 file changed, 81 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/radio/uhd/default.nix b/pkgs/applications/radio/uhd/default.nix index ffc28c3480f..291c1628753 100644 --- a/pkgs/applications/radio/uhd/default.nix +++ b/pkgs/applications/radio/uhd/default.nix @@ -3,9 +3,32 @@ , fetchFromGitHub , cmake , pkgconfig -, python -, libusb1 +# See https://files.ettus.com/manual_archive/v3.15.0.0/html/page_build_guide.html for dependencies explanations , boost +, enableLibuhd_C_api ? true +# requires numpy +, enableLibuhd_Python_api ? false +, python ? null +, enableExamples ? false +, enableUtils ? false +, enableLiberio ? false +, liberio ? null +, libusb1 ? null +, enableDpdk ? false +, dpdk ? null +# Devices +, enableOctoClock ? true +, enableMpmd ? true +, enableB100 ? true +, enableB200 ? true +, enableUsrp1 ? true +, enableUsrp2 ? true +, enableX300 ? true +, enableN230 ? true +, enableN300 ? true +, enableN320 ? true +, enableE300 ? true +, enableE320 ? true }: # You need these udev rules to not have to run as root (copied from @@ -14,6 +37,11 @@ # SUBSYSTEMS=="usb", ATTRS{idVendor}=="fffe", ATTRS{idProduct}=="0002", MODE:="0666" # SUBSYSTEMS=="usb", ATTRS{idVendor}=="2500", ATTRS{idProduct}=="0002", MODE:="0666" +let + onOffBool = b: if b then "ON" else "OFF"; + inherit (stdenv.lib) optionals; +in + stdenv.mkDerivation rec { pname = "uhd"; # UHD seems to use three different version number styles: x.y.z, xxx_yyy_zzz @@ -35,6 +63,28 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; cmakeFlags = [ + "-DENABLE_LIBUHD=ON" + "-DENABLE_USB=ON" + "-DENABLE_TESTS=ON" # This installs tests as well so we delete them via postPhases + "-DENABLE_EXAMPLES=${onOffBool enableExamples}" + "-DENABLE_UTILS=${onOffBool enableUtils}" + "-DENABLE_LIBUHD_C_API=${onOffBool enableLibuhd_C_api}" + "-DENABLE_LIBUHD_PYTHON_API=${onOffBool enableLibuhd_Python_api}" + "-DENABLE_LIBERIO=${onOffBool enableLiberio}" + "-DENABLE_DPDK=${onOffBool enableDpdk}" + # Devices + "-DENABLE_OCTOCLOCK=${onOffBool enableOctoClock}" + "-DENABLE_MPMD=${onOffBool enableMpmd}" + "-DENABLE_B100=${onOffBool enableB100}" + "-DENABLE_B200=${onOffBool enableB200}" + "-DENABLE_USRP1=${onOffBool enableUsrp1}" + "-DENABLE_USRP2=${onOffBool enableUsrp2}" + "-DENABLE_X300=${onOffBool enableX300}" + "-DENABLE_N230=${onOffBool enableN230}" + "-DENABLE_N300=${onOffBool enableN300}" + "-DENABLE_N320=${onOffBool enableN320}" + "-DENABLE_E300=${onOffBool enableE300}" + "-DENABLE_E320=${onOffBool enableE320}" ] # TODO: Check if this still needed # ABI differences GCC 7.1 @@ -42,16 +92,34 @@ stdenv.mkDerivation rec { ++ [ (stdenv.lib.optionalString stdenv.isAarch32 "-DCMAKE_CXX_FLAGS=-Wno-psabi") ] ; + # Python + Mako are always required for the build itself but not necessary for runtime. + pythonEnv = python.withPackages (ps: with ps; [ Mako ] + ++ optionals (enableLibuhd_Python_api) [ numpy setuptools ] + ++ optionals (enableUtils) [ requests six ] + ); + nativeBuildInputs = [ cmake pkgconfig - # Python + Mako are always required for the build itself but not necessary for runtime - (python.withPackages (ps: with ps; [ Mako ])) - ]; + ] + # If both enableLibuhd_Python_api and enableUtils are off, we don't need + # pythonEnv in buildInputs as it's a 'build' dependency and not a runtime + # dependency + ++ optionals (!enableLibuhd_Python_api && !enableUtils) [ pythonEnv ] + ; buildInputs = [ - libusb1 boost - ]; + libusb1 + ] + # However, if enableLibuhd_Python_api *or* enableUtils is on, we need + # pythonEnv for runtime as well. The utilities' runtime dependencies are + # handled at the environment + ++ optionals (enableLibuhd_Python_api || enableUtils) [ pythonEnv ] + ++ optionals (enableLiberio) [ liberio ] + ++ optionals (enableDpdk) [ dpdk ] + ; + + doCheck = true; # Build only the host software preConfigure = "cd host"; @@ -59,7 +127,7 @@ stdenv.mkDerivation rec { # https://files.ettus.com/manual_archive/v3.15.0.0/html/page_build_guide.html#build_instructions_unix_arm patches = if stdenv.isAarch32 then ./neon.patch else null; - postPhases = [ "installFirmware" ]; + postPhases = [ "installFirmware" "removeInstalledTests" ]; # UHD expects images in `$CMAKE_INSTALL_PREFIX/share/uhd/images` installFirmware = '' @@ -67,6 +135,11 @@ stdenv.mkDerivation rec { tar --strip-components=1 -xvf "${uhdImagesSrc}" -C "$out/share/uhd/images" ''; + # -DENABLE_TESTS=ON installs the tests, we don't need them in the output + removeInstalledTests = '' + rm -r $out/lib/uhd/tests + ''; + meta = with stdenv.lib; { description = "USRP Hardware Driver (for Software Defined Radio)"; longDescription = '' From 7da8a30a64a8e130958069343b3a5fee3e6f481e Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 9 Mar 2020 18:30:33 +0200 Subject: [PATCH 10/14] uhd: move udev rules to the standard location --- pkgs/applications/radio/uhd/default.nix | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pkgs/applications/radio/uhd/default.nix b/pkgs/applications/radio/uhd/default.nix index 291c1628753..91e28977f6f 100644 --- a/pkgs/applications/radio/uhd/default.nix +++ b/pkgs/applications/radio/uhd/default.nix @@ -31,12 +31,6 @@ , enableE320 ? true }: -# You need these udev rules to not have to run as root (copied from -# ${uhd}/share/uhd/utils/uhd-usrp.rules): -# -# SUBSYSTEMS=="usb", ATTRS{idVendor}=="fffe", ATTRS{idProduct}=="0002", MODE:="0666" -# SUBSYSTEMS=="usb", ATTRS{idVendor}=="2500", ATTRS{idProduct}=="0002", MODE:="0666" - let onOffBool = b: if b then "ON" else "OFF"; inherit (stdenv.lib) optionals; @@ -127,7 +121,9 @@ stdenv.mkDerivation rec { # https://files.ettus.com/manual_archive/v3.15.0.0/html/page_build_guide.html#build_instructions_unix_arm patches = if stdenv.isAarch32 then ./neon.patch else null; - postPhases = [ "installFirmware" "removeInstalledTests" ]; + postPhases = [ "installFirmware" "removeInstalledTests" ] + ++ optionals (enableUtils) [ "moveUdevRules" ] + ; # UHD expects images in `$CMAKE_INSTALL_PREFIX/share/uhd/images` installFirmware = '' @@ -140,6 +136,13 @@ stdenv.mkDerivation rec { rm -r $out/lib/uhd/tests ''; + # Moves the udev rules to the standard location, needed only if utils are + # enabled + moveUdevRules = '' + mkdir -p $out/lib/udev/rules.d + mv $out/lib/uhd/utils/uhd-usrp.rules $out/lib/udev/rules.d/ + ''; + meta = with stdenv.lib; { description = "USRP Hardware Driver (for Software Defined Radio)"; longDescription = '' From 0ba95d0fc2cc30179436ff9bac0b34c0b790734e Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 9 Mar 2020 18:57:08 +0200 Subject: [PATCH 11/14] uhd: switch to python3 by default --- pkgs/applications/radio/uhd/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/radio/uhd/default.nix b/pkgs/applications/radio/uhd/default.nix index 91e28977f6f..20dec9ef285 100644 --- a/pkgs/applications/radio/uhd/default.nix +++ b/pkgs/applications/radio/uhd/default.nix @@ -8,7 +8,7 @@ , enableLibuhd_C_api ? true # requires numpy , enableLibuhd_Python_api ? false -, python ? null +, python3 ? null , enableExamples ? false , enableUtils ? false , enableLiberio ? false @@ -87,7 +87,7 @@ stdenv.mkDerivation rec { ; # Python + Mako are always required for the build itself but not necessary for runtime. - pythonEnv = python.withPackages (ps: with ps; [ Mako ] + pythonEnv = python3.withPackages (ps: with ps; [ Mako ] ++ optionals (enableLibuhd_Python_api) [ numpy setuptools ] ++ optionals (enableUtils) [ requests six ] ); From b70907b9b6677f7ec8c54c159b3471634a628f48 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Fri, 3 Apr 2020 14:55:06 +0300 Subject: [PATCH 12/14] uhd: quote homepage URL --- pkgs/applications/radio/uhd/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/radio/uhd/default.nix b/pkgs/applications/radio/uhd/default.nix index 20dec9ef285..e7ddb5787fa 100644 --- a/pkgs/applications/radio/uhd/default.nix +++ b/pkgs/applications/radio/uhd/default.nix @@ -152,7 +152,7 @@ stdenv.mkDerivation rec { USRP devices are designed and sold by Ettus Research, LLC and its parent company, National Instruments. ''; - homepage = https://uhd.ettus.com/; + homepage = "https://uhd.ettus.com/"; license = licenses.gpl3Plus; platforms = platforms.linux ++ platforms.darwin; maintainers = with maintainers; [ bjornfor fpletz tomberek ]; From 518d5be4f57c97531a7dbdbc97d6a9f8dddb8a39 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Sun, 5 Apr 2020 13:03:22 +0200 Subject: [PATCH 13/14] ssh validationPackage is a single value, not a list --- nixos/modules/services/networking/ssh/sshd.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix index 464e9ed38c4..17f31e3a488 100644 --- a/nixos/modules/services/networking/ssh/sshd.nix +++ b/nixos/modules/services/networking/ssh/sshd.nix @@ -9,8 +9,8 @@ let # This middle-ground solution ensures *an* sshd can do their basic validation # on the configuration. validationPackage = if pkgs.stdenv.buildPlatform == pkgs.stdenv.hostPlatform - then [ cfgc.package ] - else [ pkgs.buildPackages.openssh ]; + then cfgc.package + else pkgs.buildPackages.openssh; sshconf = pkgs.runCommand "sshd.conf-validated" { nativeBuildInputs = [ validationPackage ]; } '' cat >$out < Date: Sun, 5 Apr 2020 13:03:35 +0200 Subject: [PATCH 14/14] zenpower: makeFlags is a list --- pkgs/os-specific/linux/zenpower/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/zenpower/default.nix b/pkgs/os-specific/linux/zenpower/default.nix index 97b69a7921b..bc1d803bb10 100644 --- a/pkgs/os-specific/linux/zenpower/default.nix +++ b/pkgs/os-specific/linux/zenpower/default.nix @@ -15,7 +15,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = kernel.moduleBuildDependencies; - makeFlags = "KERNEL_BUILD=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"; + makeFlags = [ "KERNEL_BUILD=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ]; installPhase = '' install -D zenpower.ko -t "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/hwmon/zenpower/"