mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-30 17:43:42 +00:00
0100a75801
64b4af5296
("kmod-blacklist-ubuntu: 22-1.1ubuntu1 -> 28-1ubuntu4")
doubled the size of the default initramfs. This happened because the
upgrade introduced this configuration:
remove iwlwifi \
(/sbin/lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs /sbin/rmmod) \
&& /sbin/modprobe -r mac80211
This meant that the grep and xargs substitutions, which had been
inactive for years, suddenly became active again and became part of
kmod-blacklist-ubuntu's closure.
Since we're already using /run/booted-system for the kmod binaries,
I think it's okay to use it for grep and xargs as well. Both are
required NixOS packages, so they're guaranteed to be there.
Large increases in initramfs size are problematic, because it's often
not possible for users to do anything about them. It's not always
possible to increase the size of /boot, because some filesystems like
ZFS don't support being shrunk to make way for a bigger /boot.
40 lines
1.3 KiB
Nix
40 lines
1.3 KiB
Nix
{ lib, stdenv, fetchurl }:
|
|
|
|
let
|
|
version = "28-1ubuntu4"; # impish 2021-06-24
|
|
|
|
in stdenv.mkDerivation {
|
|
pname = "kmod-blacklist";
|
|
inherit version;
|
|
|
|
src = fetchurl {
|
|
url = "https://launchpad.net/ubuntu/+archive/primary/+files/kmod_${version}.debian.tar.xz";
|
|
sha256 = "sha256-K8tWpaLmCm3Jcxw3OZ+D7Koiug7epooRn1YMfqjGAiw=";
|
|
};
|
|
|
|
installPhase = ''
|
|
mkdir "$out"
|
|
for f in modprobe.d/*.conf; do
|
|
echo "''\n''\n## file: "`basename "$f"`"''\n''\n" >> "$out"/modprobe.conf
|
|
cat "$f" >> "$out"/modprobe.conf
|
|
# https://bugs.launchpad.net/ubuntu/+source/kmod/+bug/1475945
|
|
sed -i '/^blacklist i2c_i801/d' $out/modprobe.conf
|
|
done
|
|
|
|
substituteInPlace "$out"/modprobe.conf \
|
|
--replace "blacklist bochs-drm" "" \
|
|
--replace /sbin/lsmod /run/booted-system/sw/bin/lsmod \
|
|
--replace /sbin/rmmod /run/booted-system/sw/bin/rmmod \
|
|
--replace /sbin/modprobe /run/booted-system/sw/bin/modprobe \
|
|
--replace " grep " " /run/booted-system/sw/bin/grep " \
|
|
--replace " xargs " " /run/booted-system/sw/bin/xargs "
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "https://launchpad.net/ubuntu/+source/kmod";
|
|
description = "Linux kernel module blacklists from Ubuntu";
|
|
platforms = platforms.linux;
|
|
license = with licenses; [ gpl2Plus lgpl21Plus ];
|
|
};
|
|
}
|