nixpkgs-suyu/pkgs/os-specific/linux/gogoclient/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

44 lines
1.5 KiB
Nix

{lib, stdenv, fetchurl, openssl, nettools, iproute, sysctl}:
let baseName = "gogoclient";
version = "1.2";
in
stdenv.mkDerivation rec {
name = "${baseName}-${version}";
src = fetchurl {
#url = "http://gogo6.com/downloads/gogoc-1_2-RELEASE.tar.gz";
url = "https://src.fedoraproject.org/repo/pkgs/gogoc/gogoc-1_2-RELEASE.tar.gz/41177ed683cf511cc206c7782c37baa9/gogoc-1_2-RELEASE.tar.gz";
sha256 = "a0ef45c0bd1fc9964dc8ac059b7d78c12674bf67ef641740554e166fa99a2f49";
};
patches = [./gcc46-include-fix.patch ./config-paths.patch ];
makeFlags = ["target=linux"];
installFlags = ["installdir=$(out)"];
hardeningDisable = [ "format" ];
buildInputs = [openssl];
preFixup = ''
mkdir -p $out/share/${name}
chmod 444 $out/bin/gogoc.conf
mv $out/bin/gogoc.conf $out/share/${name}/gogoc.conf.sample
rm $out/bin/gogoc.conf.sample
substituteInPlace "$out/template/linux.sh" \
--replace "/sbin/ifconfig" "${nettools}/bin/ifconfig" \
--replace "/sbin/route" "${nettools}/bin/route" \
--replace "/sbin/ip" "${iproute}/sbin/ip" \
--replace "/sbin/sysctl" "${sysctl}/bin/sysctl"
sed -i -e 's/^.*Exec \$route -A.*$/& metric 128/' $out/template/linux.sh
'';
meta = with lib; {
homepage = "https://ipv6.ernet.in/Tunnel_broker";
description = "Client to connect to the Freenet6 IPv6 tunnel broker service";
maintainers = [ maintainers.bluescreen303 ];
license = licenses.bsd3;
platforms = platforms.linux;
};
}