nixpkgs/pkgs/by-name/bc/bcache-tools/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

63 lines
1.7 KiB
Nix

{ lib, stdenv, fetchFromGitHub, pkg-config, util-linux, bash, substituteAll }:
stdenv.mkDerivation rec {
pname = "bcache-tools";
version = "1.0.8";
src = fetchFromGitHub {
owner = "g2p";
repo = "bcache-tools";
rev = "v${version}";
hash = "sha256-6gy0ymecMgEHXbwp/nXHlrUEeDFnmFXWZZPlzP292g4=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ util-linux ];
# * 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" \
-e "s/pkg-config/$PKG_CONFIG/" \
-i Makefile
'';
patches = [
(substituteAll {
src = ./bcache-udev-modern.patch;
shell = "${bash}/bin/sh";
})
./fix-static.patch
];
makeFlags = [
"PREFIX=${placeholder "out"}"
"UDEVLIBDIR=${placeholder "out"}/lib/udev/"
];
preInstall = ''
mkdir -p "$out/sbin" "$out/lib/udev/rules.d" "$out/share/man/man8"
'';
meta = with 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 = "https://bcache.evilpiepirate.org/";
license = licenses.gpl2Only;
platforms = platforms.linux;
maintainers = [ maintainers.bjornfor ];
};
}