Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a0943687d2a5094a6d92f25a4b6e16a76b5b7
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

111 lines
3.0 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
popt,
avahi,
pkg-config,
python3,
gtk3,
runCommand,
gcc,
autoconf,
automake,
which,
procps,
libiberty_static,
runtimeShell,
sysconfDir ? "", # set this parameter to override the default value $out/etc
static ? false,
}:
let
pname = "distcc";
version = "2021-03-11";
distcc = stdenv.mkDerivation {
inherit pname version;
src = fetchFromGitHub {
owner = "distcc";
repo = "distcc";
rev = "de21b1a43737fbcf47967a706dab4c60521dbbb1";
sha256 = "0zjba1090awxkmgifr9jnjkxf41zhzc4f6mrnbayn3v6s77ca9x4";
};
nativeBuildInputs = [
pkg-config
autoconf
automake
which
(python3.withPackages (p: [ p.setuptools ]))
];
buildInputs = [
popt
avahi
gtk3
procps
libiberty_static
];
preConfigure = ''
export CPATH=$(ls -d ${gcc.cc}/lib/gcc/*/${gcc.cc.version}/plugin/include)
configureFlagsArray=( CFLAGS="-O2 -fno-strict-aliasing"
CXXFLAGS="-O2 -fno-strict-aliasing"
--mandir=$out/share/man
${lib.optionalString (sysconfDir != "") "--sysconfdir=${sysconfDir}"}
${lib.optionalString static "LDFLAGS=-static"}
${lib.withFeature (static == true || popt == null) "included-popt"}
${lib.withFeature (avahi != null) "avahi"}
${lib.withFeature (gtk3 != null) "gtk"}
--without-gnome
--enable-rfc2553
--disable-Werror # a must on gcc 4.6
)
installFlags="sysconfdir=$out/etc";
./autogen.sh
'';
# The test suite fails because it uses hard-coded paths, i.e. /usr/bin/gcc.
doCheck = false;
passthru = {
# A derivation that provides gcc and g++ commands, but that
# will end up calling distcc for the given cacheDir
#
# extraConfig is meant to be sh lines exporting environment
# variables like DISTCC_HOSTS, DISTCC_DIR, ...
links =
extraConfig:
(runCommand "distcc-links" { passthru.gcc = gcc.cc; } ''
mkdir -p $out/bin
if [ -x "${gcc.cc}/bin/gcc" ]; then
cat > $out/bin/gcc << EOF
#!${runtimeShell}
${extraConfig}
exec ${distcc}/bin/distcc gcc "\$@"
EOF
chmod +x $out/bin/gcc
fi
if [ -x "${gcc.cc}/bin/g++" ]; then
cat > $out/bin/g++ << EOF
#!${runtimeShell}
${extraConfig}
exec ${distcc}/bin/distcc g++ "\$@"
EOF
chmod +x $out/bin/g++
fi
'');
};
meta = {
description = "Fast, free distributed C/C++ compiler";
homepage = "http://distcc.org";
license = "GPL";
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ anderspapitto ];
};
};
in
distcc