Merge pull request #113079 from SuperSandro2000/wget2

This commit is contained in:
Sandro 2021-02-17 16:05:58 +01:00 committed by GitHub
commit 6e442e9633
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 182 additions and 8 deletions

View file

@ -0,0 +1,40 @@
{ lib, stdenv, fetchFromGitLab, fetchurl, autoconf-archive, autoreconfHook, pkg-config, python3 }:
let
chromium_version = "90.0.4417.1";
hsts_list = fetchurl {
url = "https://raw.github.com/chromium/chromium/${chromium_version}/net/http/transport_security_state_static.json";
sha256 = "09f24n30x5dmqk8zk7k2glcilgr27832a3304wj1yp97158sqsfx";
};
in
stdenv.mkDerivation rec {
pname = "libhsts";
version = "0.1.0";
src = fetchFromGitLab {
owner = "rockdaboot";
repo = pname;
rev = "libhsts-${version}";
sha256 = "0gbchzf0f4xzb6zjc56dk74hqrmdgyirmgxvvsqp9vqn9wb5kkx4";
};
postPatch = ''
pushd tests
cp ${hsts_list} transport_security_state_static.json
sed 's/^ *\/\/.*$//g' transport_security_state_static.json >hsts.json
popd
patchShebangs src/hsts-make-dafsa
'';
nativeBuildInputs = [ autoconf-archive autoreconfHook pkg-config python3 ];
outputs = [ "out" "dev" ];
meta = with lib; {
description = "Library to easily check a domain against the Chromium HSTS Preload list";
homepage = "https://gitlab.com/rockdaboot/libhsts";
license = with licenses; [ mit bsd3 ];
maintainers = with maintainers; [ SuperSandro2000 ];
};
}

View file

@ -0,0 +1,13 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq
set -euo pipefail -x
cd "$(dirname "$0")"
chromium_version=$(curl -s "https://api.github.com/repos/chromium/chromium/tags" | jq -r 'map(select(.prerelease | not)) | .[1].name')
sha256=$(nix-prefetch-url "https://raw.github.com/chromium/chromium/$chromium_version/net/http/transport_security_state_static.json")
sed -e "0,/chromium_version/s/chromium_version = \".*\"/chromium_version = \"$chromium_version\"/" \
-e "0,/sha256/s/sha256 = \".*\"/sha256 = \"$sha256\"/" \
--in-place ./default.nix

View file

@ -1,4 +1,4 @@
{ lib, stdenv, fetchgit }:
{ lib, stdenv, fetchgit, python3 }:
stdenv.mkDerivation {
pname = "gnulib";
@ -10,19 +10,26 @@ stdenv.mkDerivation {
sha256 = "0hkg3nql8nsll0vrqk4ifda0v4kpi67xz42r8daqsql6c4rciqnw";
};
dontFixup = true;
# no "make install", gnulib is a collection of source code
postPatch = ''
patchShebangs gnulib-tool.py
'';
buildInputs = [ python3 ];
installPhase = ''
mkdir -p $out; mv * $out/
ln -s $out/lib $out/include
mkdir -p $out/bin
cp -r * $out/
ln -s $out/lib $out/include
ln -s $out/gnulib-tool $out/bin/
'';
meta = {
# do not change headers to not update all vendored build files
dontFixup = true;
meta = with lib; {
homepage = "https://www.gnu.org/software/gnulib/";
description = "Central location for code to be shared among GNU packages";
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.unix;
license = licenses.gpl3Plus;
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,100 @@
{ lib
, stdenv
, fetchFromGitLab
, fetchpatch
# build support
, autoreconfHook
, flex
, gnulib
, lzip
, pkg-config
, python3
, texinfo
# libraries
, brotli
, bzip2
, gpgme
, libhsts
, libidn2
, libpsl
, lzma
, nghttp2
, sslSupport ? true
, openssl
, pcre2
, zlib
, zstd
}:
stdenv.mkDerivation rec {
pname = "wget2";
version = "1.99.2";
src = fetchFromGitLab {
owner = "gnuwget";
repo = pname;
rev = version;
sha256 = "1gws8y3z8xzi46c48n7jb162mr3ar4c34s7yy8kjcs14yzq951qz";
};
patches = [
(fetchpatch {
name = "fix-autotools-2.70.patch";
url = "https://gitlab.com/gnuwget/wget2/-/commit/580af869093cfda6bc8a9d5901850354a16b3666.patch";
sha256 = "1x6wq4wxvvy6174d52qrhxkcgmv366f8smxyki49zb6rs4gqhskd";
})
(fetchpatch {
name = "update-potfiles-for-gnulib-2020-11-28.patch";
url = "https://gitlab.com/gnuwget/wget2/-/commit/368deb9fcca0c281f9c76333607cc878c3945ad0.patch";
sha256 = "1qsz8hbzbgg14wikxsbjjlq0cp3jw4pajbaz9wdn6ny617hdvi8y";
})
];
# wget2_noinstall contains forbidden reference to /build/
postPatch = ''
substituteInPlace src/Makefile.am \
--replace 'bin_PROGRAMS = wget2 wget2_noinstall' 'bin_PROGRAMS = wget2'
'';
nativeBuildInputs = [ autoreconfHook flex lzip pkg-config python3 texinfo ];
buildInputs = [ brotli bzip2 gpgme libhsts libidn2 libpsl lzma nghttp2 pcre2 zlib zstd ]
++ lib.optional sslSupport openssl;
# TODO: include translation files
autoreconfPhase = ''
# copy gnulib into build dir and make writable.
# Otherwise ./bootstrap copies the non-writable files from nix store and fails to modify them
rmdir gnulib
cp -r ${gnulib} gnulib
chmod -R u+w gnulib/{build-aux,lib}
# fix bashisms can be removed when https://gitlab.com/gnuwget/wget2/-/commit/c9499dcf2f58983d03e659e2a1a7f21225141edf is in the release
sed 's|==|=|g' -i configure.ac
./bootstrap --no-git --gnulib-srcdir=gnulib --skip-po
'';
configureFlags = [
"--disable-static"
# TODO: https://gitlab.com/gnuwget/wget2/-/issues/537
(lib.withFeatureAs sslSupport "ssl" "openssl")
];
outputs = [ "out" "lib" "dev" ];
meta = with lib; {
description = "successor of GNU Wget, a file and recursive website downloader.";
longDescription = ''
Designed and written from scratch it wraps around libwget, that provides the basic
functions needed by a web client.
Wget2 works multi-threaded and uses many features to allow fast operation.
In many cases Wget2 downloads much faster than Wget1.x due to HTTP2, HTTP compression,
parallel connections and use of If-Modified-Since HTTP header.
'';
homepage = "https://gitlab.com/gnuwget/wget2";
# wget2 GPLv3+; libwget LGPLv3+
license = with licenses; [ gpl3Plus lgpl3Plus ];
maintainers = with maintainers; [ SuperSandro2000 ];
};
}

View file

@ -9070,6 +9070,18 @@ in
libpsl = null;
};
wget2 = callPackage ../tools/networking/wget2 {
# update breaks grub2
gnulib = pkgs.gnulib.overrideAttrs (oldAttrs: rec {
version = "20210208";
src = fetchgit {
url = "https://git.savannah.gnu.org/r/gnulib.git";
rev = "0b38e1d69f03d3977d7ae7926c1efeb461a8a971";
sha256 = "06bj9y8wcfh35h653yk8j044k7h5g82d2j3z3ib69rg0gy1xagzp";
};
});
};
wg-bond = callPackage ../applications/networking/wg-bond { };
which = callPackage ../tools/system/which { };
@ -13876,6 +13888,8 @@ in
libgit2-glib = callPackage ../development/libraries/libgit2-glib { };
libhsts = callPackage ../development/libraries/libhsts { };
glbinding = callPackage ../development/libraries/glbinding { };
gle = callPackage ../development/libraries/gle { };