mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 03:17:13 +00:00
581226cfb4
Or else `services.udev.packages = [ bcache-tools ]` cannot be used.
To not break bcache in the initrd I'm modifying this in stage-1.nix:
- --replace /bin/sh ${extraUtils}/bin/sh
+ --replace ${bash}/bin/sh ${extraUtils}/bin/sh
Reasoning behind that change:
* If not modifying the /bin/sh pattern in any way, it will also match
${bash}/bin/sh, creating a broken path like
/nix/store/HASH-bash/nix/store/HASH-bash/bin/sh in the udev rule file.
* The addition of /bin/sh was done in 775f381a9e
("stage-1: add bcache support"). It seems somewhat plausible that
no new users have appeared since then and we can take this opportunity
to back out of this change without much fear of regressions.
If there _are_ regressions, they should be in the form of build time
errors, not runtime (boot), due to how the udev rule output is checked
for invalid path references. So low risk, IMHO.
* An alternative approach could be to copy the /bin/sh substitute rule
over to the non-initrd udev rules implementation in NixOS, but I think
this way is better:
- The rules file comes with a working path out of the box.
- We can use more precise pattern matching when modifying the udev
rules for the initrd.
57 lines
1.7 KiB
Nix
57 lines
1.7 KiB
Nix
{ stdenv, fetchurl, pkgconfig, utillinux, bash }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
name = "bcache-tools-${version}";
|
|
version = "1.0.7";
|
|
|
|
src = fetchurl {
|
|
name = "${name}.tar.gz";
|
|
url = "https://github.com/g2p/bcache-tools/archive/v${version}.tar.gz";
|
|
sha256 = "1gbsh2qw0a7kgck6w0apydiy37nnz5xvdgipa0yqrfmghl86vmv4";
|
|
};
|
|
|
|
buildInputs = [ pkgconfig utillinux ];
|
|
|
|
# * Remove broken install rules (they ignore $PREFIX) for stuff we don't need
|
|
# anyway (it's distro specific stuff).
|
|
# * Fixup absolute path to modprobe.
|
|
prePatch = ''
|
|
sed -e "/INSTALL.*initramfs\/hook/d" \
|
|
-e "/INSTALL.*initcpio\/install/d" \
|
|
-e "/INSTALL.*dracut\/module-setup.sh/d" \
|
|
-i Makefile
|
|
'';
|
|
|
|
patches = [
|
|
./bcache-udev-modern.patch
|
|
./fix-static.patch
|
|
];
|
|
|
|
preBuild = ''
|
|
export makeFlags="$makeFlags PREFIX=\"$out\" UDEVLIBDIR=\"$out/lib/udev/\"";
|
|
sed -e "s|/bin/sh|${bash}/bin/sh|" -i *.rules
|
|
'';
|
|
|
|
preInstall = ''
|
|
mkdir -p "$out/sbin" "$out/lib/udev/rules.d" "$out/share/man/man8"
|
|
'';
|
|
|
|
meta = with stdenv.lib; {
|
|
description = "User-space tools required for bcache (Linux block layer cache)";
|
|
longDescription = ''
|
|
Bcache is a Linux kernel block layer cache. It allows one or more fast
|
|
disk drives such as flash-based solid state drives (SSDs) to act as a
|
|
cache for one or more slower hard disk drives.
|
|
|
|
This package contains the required user-space tools.
|
|
|
|
User documentation is in Documentation/bcache.txt in the Linux kernel
|
|
tree.
|
|
'';
|
|
homepage = http://bcache.evilpiepirate.org/;
|
|
license = licenses.gpl2;
|
|
platforms = platforms.linux;
|
|
maintainers = [ maintainers.bjornfor ];
|
|
};
|
|
}
|