neoidiosyn/overlay.nix

311 lines
8.3 KiB
Nix
Raw Normal View History

2024-11-16 21:05:58 +01:00
{ lib, ... }: final: prev: let
final' = final;
prev' = prev;
alias = target: pkg: final.runCommand target { } ''
mkdir -p "$out/bin"
ln -s "${lib.getExe pkg}" "$out/bin/${target}"
'';
fetchFromGitHub = let
fetchzip = final.buildPackages.fetchzip.override { withUnzip = false; };
in lib.makeOverridable ({ owner, repo, rev, hash, ... }: fetchzip {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
inherit hash;
});
in {
# compilers
llvmPackages = final.llvmPackages_latest;
gcc = final.gcc_latest;
gfortran = prev.wrapCC ((final.gcc.cc.overrideAttrs (prevAttrs: {
configureFlags = prevAttrs.configureFlags or [ ] ++ [ "--disable-cody" ];
})).override {
name = "gfortran";
langFortran = true;
langC = false;
langCC = false;
enablePlugin = false;
});
# memory allocation
mimalloc = prev.mimalloc.override { secureBuild = true; };
jemalloc = throw "jemalloc is not supported";
bind = prev.bind.override { jemalloc = null; };
# Package replacements
jq = alias "jq" final.jaq;
zlib = final.callPackage ./zlib.nix { };
# cURL
curl = prev.curl.override {
gssSupport = false;
http3Support = true;
scpSupport = false;
zstdSupport = true;
openssl = final.quictls;
};
# cURL HTTP3 dependencies
ngtcp2 = prev.ngtcp2.override { inherit fetchFromGitHub; };
nghttp3 = prev.nghttp3.override { inherit fetchFromGitHub; };
# scopes
netbsd = prev.netbsd.overrideScope (final: prev: {
compatIfNeeded = [ final.compat ];
compat = prev.compat.overrideAttrs (prevAttrs: {
makeFlags = prevAttrs.makeFlags ++ [ "OBJCOPY=:" ];
});
});
# Perl
perlPackages = prev.perlPackages.overrideScope (final: prev: {
DBI = prev.DBI.overrideAttrs (prevAttrs: {
nativeBuildInputs = prevAttrs.nativeBuildInputs or [ ] ++ [
final'.stdenv.cc
final'.stdenv.cc.bintools
];
makeMakerFlags = prevAttrs.makeMakerFlags or [ ] ++ [
"CC=${final'.stdenv.cc.targetPrefix}cc"
"LD=${final'.stdenv.cc.targetPrefix}cc"
"CCFLAGS=-Doff64_t=off_t"
];
});
});
# Python
python313 = (prev.python313.overrideAttrs (prevAttrs: {
nativeBuildInputs = prevAttrs.nativeBuildInputs or [ ] ++ [ final.stdenv.cc.bintools ];
})).override {
packageOverrides = final: prev: {
pyflakes = prev.pyflakes.overrideAttrs {
doCheck = false;
doInstallCheck = false;
};
sphinx = prev.sphinx.overrideAttrs {
doCheck = false;
doInstallCheck = false;
};
};
};
python313Packages = final.python313.pkgs;
python3 = final.python313;
python3Packages = final.python313Packages;
# individual packages
beam = prev.beam_nox;
cairo = prev.cairo.override { x11Support = false; };
cups = prev.cups.overrideAttrs {
autoVarInit = "zero";
boundsCheck = true;
};
dbus = prev.dbus.override { x11Support = false; };
diffutils = prev.diffutils.overrideAttrs (prevAttrs: {
configureFlags = prevAttrs.configureFlags or [ ] ++ [ "--disable-nls" ];
postPatch = ''
sed -E -i 's/test-(getopt-(gnu|posix)|(c|m|re)alloc-gnu)//g' gnulib-tests/Makefile.in
'';
});
electron = prev.electron.override {
electron-unwrapped = prev.electron.unwrapped.overrideAttrs (prevAttrs: {
autoVarInit = true;
boundsCheck = true;
gnFlags = prevAttrs.gnFlags or "" + ''
# Disable X11
ozone_platform_x11 = false
# Disable internal memory allocator
use_partition_alloc_as_malloc = false
enable_backup_ref_ptr_support = false
enable_pointer_compression_support = false
'';
});
};
ffmpeg = final.ffmpeg-headless;
ffmpeg-headless = (prev.ffmpeg-headless.overrideAttrs {
ffpContract = false;
}).override {
withAlsa = false;
withSsh = false;
};
gd = prev.gd.override { withXorg = false; };
ghostscript = prev.ghostscript.override { x11Support = false; };
gobject-introspection = prev.gobject-introspection.override { x11Support = false; };
graphviz = prev.graphviz-nox;
gtk3 = prev.gtk3.override {
x11Support = false;
xineramaSupport = false;
};
gtk4 = prev.gtk4.override {
x11Support = false;
xineramaSupport = false;
};
imagemagick = prev.imagemagick.override {
libX11Support = false;
libXtSupport = false;
};
imlib2 = prev.imlib2.override { x11Support = false; };
iproute2 = prev.iproute2.overrideAttrs (prevAttrs: {
patches = prevAttrs.patches or [ ] ++ [
(final.fetchpatch {
url = "https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/patch/?id=043ef90e2fa94397eb5c85330889ca4146a6d58a";
hash = "sha256-6q4NcdT2YXhhbMgLaiAjO2WFUcM9Pv8+J34rGzJqU5Q=";
})
];
});
jdk8 = prev.jdk8_headless;
jre8 = prev.jre8_headless;
kexec-tools = prev.kexec-tools.overrideAttrs (prevAttrs: {
makeFlags = prevAttrs.makeFlags or [ ] ++ [ "BUILD_KEXEC_TEST=no" ];
});
libdrm = prev.libdrm.override { withValgrind = false; };
libepoxy = prev.libepoxy.overrideAttrs (prevAttrs: {
buildInputs = prevAttrs.buildInputs or [ ] ++ [ final.libGL ];
mesonFlags = prevAttrs.mesonFlags or [ ] ++ [ "-Degl=yes" ];
});
libjpeg = prev.libjpeg.overrideAttrs (prevAttrs: {
cmakeFlags = prevAttrs.cmakeFlags or [ ] ++ [ "-DFLOATTEST12=fp-contract" ];
});
libpng = prev.libpng.overrideAttrs (prevAttrs: {
postPatch = prevAttrs.postPatch or "" + ''
substituteInPlace tests/pngtest-all \
--replace-warn --strict --relaxed
'';
});
libpng-apng = final.libpng.override { apngSupport = true; };
libpulseaudio = prev.libpulseaudio.override { fftwFloat = null; };
librist = prev.librist.overrideAttrs (finalAttrs: prevAttrs: {
version = assert prevAttrs.version == "0.2.10"; "0.2.11";
src = prevAttrs.src.override {
rev = "refs/tags/${finalAttrs.version}";
hash = "sha256-xWqyQl3peB/ENReMcDHzIdKXXCYOJYbhhG8tcSh36dY=";
};
patches = [ ];
});
makeInitrdNG = prev.makeInitrdNG.overrideAttrs (prevAttrs: {
NIX_RUSTFLAGS = prevAttrs.NIX_RUSTFLAGS
|> map (flag: if flag == "lto" then "embed-bitcode=no" else flag);
});
mercurial = prev.mercurial.override { re2Support = false; };
mesa = (prev.mesa.overrideAttrs (prevAttrs: {
outputs = prevAttrs.outputs |> lib.remove "spirv2dxil";
})).override {
galliumDrivers = [
"llvmpipe"
"nouveau"
"radeonsi"
"virgl"
"zink"
];
vulkanDrivers = [
"amd"
"intel"
"nouveau"
"swrast"
"virtio"
];
};
mpv = final.mpv-unwrapped.wrapper { mpv = final.mpv-unwrapped; };
mpv-unwrapped = prev.mpv-unwrapped.override {
alsaSupport = false;
cacaSupport = false;
openalSupport = false;
sdl2Support = false;
vdpauSupport = false;
x11Support = false;
};
nlohmann_json = prev.nlohmann_json.override { stdenv = final.gccStdenv; };
nodejs = prev.nodejs.overrideAttrs { doCheck = false; };
openjdk8 = prev.openjdk_headless;
openssh = prev.openssh.overrideAttrs {
autoVarInit = "zero";
boundsCheck = true;
};
pango = prev.pango.override { x11Support = false; };
pipewire = prev.pipewire.override { x11Support = false; };
speexdsp = prev.speexdsp.override { withFftw3 = false; };
systemd = prev.systemd.override {
withApparmor = false;
withIptables = false;
};
vim-full = prev.vim-full.override { guiSupport = false; };
wayland = prev.wayland.override { withDocumentation = false; };
w3m = prev.w3m.override {
x11Support = false;
imlib2 = final.imlib2;
};
wasilibc = prev.wasilibc.overrideAttrs (finalAttrs: prevAttrs: {
version = "24";
src = prevAttrs.src.override {
rev = "refs/tags/wasi-sdk-${finalAttrs.version}";
hash = "sha256-wfOvOWVJDH5+tC5pSTLV5FUPqf25W+A2N/vXlq4nSmk=";
};
});
xvfb-run = final.callPackage ./xvfb-run.nix {
cage = final.cage.override {
wlroots = final.wlroots.override { enableXWayland = false; };
xwayland = null;
};
};
} // lib.optionalAttrs (!prev.stdenv.buildPlatform.isx86) {
writeShellApplication = { ... }@args: prev.writeShellApplication (args // {
checkPhase = args.checkPhase or ''
runHook preCheck
${final.stdenv.shellDryRun} "$target"
runHook postCheck
'';
});
sudo-rs = (prev.sudo-rs.overrideAttrs {
postInstall = "";
}).override {
pandoc = null;
};
}