Merge staging-next into staging

This commit is contained in:
Frederik Rietdijk 2020-04-05 13:14:01 +02:00
commit aaf632bdbb
6 changed files with 165 additions and 79 deletions

View File

@ -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 <<EOL

View File

@ -1,57 +1,129 @@
{ 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):
#
# SUBSYSTEMS=="usb", ATTRS{idVendor}=="fffe", ATTRS{idProduct}=="0002", MODE:="0666"
# SUBSYSTEMS=="usb", ATTRS{idVendor}=="2500", ATTRS{idProduct}=="0002", MODE:="0666"
{ stdenv
, fetchurl
, fetchFromGitHub
, cmake
, pkgconfig
# 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
, python3 ? 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
}:
let
uhdVer = "v" + version;
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
# 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;
# 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<uhd::range_t>::iterator {aka __gnu_cxx::__normal_iterator<uhd::range_t*, std::vector<uhd::range_t> >}' changed in GCC 7.1
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
# /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<uhd::range_t>::iterator {aka __gnu_cxx::__normal_iterator<uhd::range_t*, std::vector<uhd::range_t> >}' 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") ];
# Python + Mako are always required for the build itself but not necessary for runtime.
pythonEnv = python3.withPackages (ps: with ps; [ Mako ]
++ optionals (enableLibuhd_Python_api) [ numpy setuptools ]
++ optionals (enableUtils) [ requests six ]
);
nativeBuildInputs = [ cmake pkgconfig ];
nativeBuildInputs = [
cmake
pkgconfig
]
# 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 = [
(python.withPackages (ps: with ps; [ Mako six requests ]))
orc
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";
# 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" ];
postPhases = [ "installFirmware" "removeInstalledTests" ]
++ optionals (enableUtils) [ "moveUdevRules" ]
;
# UHD expects images in `$CMAKE_INSTALL_PREFIX/share/uhd/images`
installFirmware = ''
@ -59,6 +131,18 @@ in stdenv.mkDerivation {
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
'';
# 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 = ''
@ -68,7 +152,7 @@ in stdenv.mkDerivation {
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 ];

View File

@ -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/"

View File

@ -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 ];

View File

@ -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, includesPerl ? false
, name, suffix ? "", src, crates ? null
}:
let
@ -29,7 +30,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 +39,16 @@ common =
nativeBuildInputs =
[ pkgconfig ]
++ lib.optionals (!is20) [ curl perl ]
++ 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 ]
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 +67,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
@ -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) ''
@ -97,12 +103,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 +144,7 @@ common =
};
passthru = {
perl-bindings = if includesPerl then nix else stdenv.mkDerivation {
perl-bindings = stdenv.mkDerivation {
pname = "nix-perl";
inherit version;
@ -154,8 +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 ]
++ lib.optional is20 boost;
[ perl pkgconfig curl nix libsodium boost autoreconfHook autoconf-archive ];
configureFlags =
[ "--with-dbi=${perlPackages.DBI}/${perl.libPrefix}"
@ -174,19 +174,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 {
@ -201,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;
@ -212,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;

View File

@ -25446,7 +25446,6 @@ in
boehmgc = boehmgc.override { enableLargeConfig = true; };
})
nix
nix1
nixStable
nixUnstable
nixFlakes;