nixpkgs/pkgs/tools/filesystems/bcache-tools/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

63 lines
1.8 KiB
Nix

{ lib, stdenv, fetchurl, pkgconfig, util-linux, bash }:
stdenv.mkDerivation rec {
pname = "bcache-tools";
version = "1.0.7";
src = fetchurl {
name = "${pname}-${version}.tar.gz";
url = "https://github.com/g2p/bcache-tools/archive/v${version}.tar.gz";
sha256 = "1gbsh2qw0a7kgck6w0apydiy37nnz5xvdgipa0yqrfmghl86vmv4";
};
nativeBuildInputs = [ pkgconfig ];
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 = [
./bcache-udev-modern.patch
./fix-static.patch
];
makeFlags = [
"PREFIX=${placeholder "out"}"
"UDEVLIBDIR=${placeholder "out"}/lib/udev/"
];
preBuild = ''
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 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.gpl2;
platforms = platforms.linux;
maintainers = [ maintainers.bjornfor ];
};
}