nixpkgs/pkgs/tools/filesystems/zfstools/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

41 lines
1 KiB
Nix

{ lib, stdenv, fetchFromGitHub, ruby, zfs }:
let version = "0.3.6"; in
stdenv.mkDerivation rec {
pname = "zfstools";
inherit version;
src = fetchFromGitHub {
sha256 = "16lvw3xbmxp2pr8nixqn7lf4504zaaxvbbdnjkv4dggwd4lsdjyg";
rev = "v${version}";
repo = "zfstools";
owner = "bdrewery";
};
buildInputs = [ ruby ];
installPhase = ''
mkdir -p $out/bin
cp bin/* $out/bin/
cp -R lib $out/
for f in $out/bin/*; do
substituteInPlace $f --replace "/usr/bin/env ruby" "ruby -I$out/lib"
done
sed -e 's|cmd.*=.*"zfs |cmd = "${zfs}/sbin/zfs |g' -i $out/lib/zfstools/{dataset,snapshot}.rb
'';
meta = with lib; {
inherit version;
inherit (src.meta) homepage;
description = "OpenSolaris-compatible auto-snapshotting script for ZFS";
longDescription = ''
zfstools is an OpenSolaris-like and compatible auto snapshotting script
for ZFS, which also supports auto snapshotting mysql databases.
'';
license = licenses.bsd2;
platforms = platforms.linux;
};
}