mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-22 00:00:03 +03:00
update default.nix to use latest dependencies and newer stdenv, as well as be flake compatible and overlay compatible
This commit is contained in:
parent
b7254160d9
commit
e70c66e3b5
162
default.nix
162
default.nix
@ -1,32 +1,144 @@
|
||||
{ nixpkgs ? (import ./nix/nixpkgs.nix)
|
||||
}:
|
||||
{ lib
|
||||
, filter
|
||||
|
||||
with nixpkgs;
|
||||
, stdenv
|
||||
, pkg-config
|
||||
, attr
|
||||
, libuuid
|
||||
, libscrypt
|
||||
, libsodium
|
||||
, keyutils
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "bcachefs-tools-${version}";
|
||||
version = "git";
|
||||
, liburcu
|
||||
, zlib
|
||||
, libaio
|
||||
, udev
|
||||
, zstd
|
||||
, lz4
|
||||
|
||||
src = lib.cleanSource ./.; # NOTE: ignore .git, otherwise things get weird!
|
||||
, python39
|
||||
, python39Packages
|
||||
, docutils
|
||||
, nixosTests
|
||||
|
||||
nativeBuildInputs = [ git pkgconfig ];
|
||||
buildInputs =
|
||||
[ liburcu libuuid libaio zlib attr keyutils
|
||||
libsodium libscrypt
|
||||
];
|
||||
, lastModified
|
||||
, versionString ? lastModified
|
||||
|
||||
enableParallelBuilding = true;
|
||||
makeFlags =
|
||||
[ "PREFIX=$(out)"
|
||||
];
|
||||
, inShell ? false
|
||||
, debugMode ? inShell
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Userspace tools for bcachefs";
|
||||
homepage = http://bcachefs.org;
|
||||
license = licenses.gpl2;
|
||||
platforms = platforms.linux;
|
||||
maintainers =
|
||||
[ "Kent Overstreet <kent.overstreet@gmail.com>"
|
||||
];
|
||||
};
|
||||
, testWithValgrind ? true
|
||||
, valgrind
|
||||
|
||||
, fuseSupport ? false
|
||||
, fuse3 ? null }:
|
||||
|
||||
assert fuseSupport -> fuse3 != null;
|
||||
assert testWithValgrind -> valgrind != null;
|
||||
stdenv.mkDerivation {
|
||||
pname = "bcachefs-tools";
|
||||
|
||||
version = "v0.1-flake-${versionString}";
|
||||
VERSION = "v0.1-flake-${versionString}";
|
||||
|
||||
src = filter.filter {
|
||||
name = "bcachefs-tools";
|
||||
root = ./.;
|
||||
exclude = [
|
||||
./rust-src
|
||||
|
||||
./.git
|
||||
./nix
|
||||
|
||||
./flake.nix
|
||||
./flake.lock
|
||||
];
|
||||
};
|
||||
|
||||
postPatch = "patchShebangs --build doc/macro2rst.py";
|
||||
|
||||
nativeBuildInputs = [
|
||||
# used to find dependencies
|
||||
## see ./INSTALL
|
||||
pkg-config
|
||||
];
|
||||
buildInputs = [
|
||||
# bcachefs explicit dependencies
|
||||
## see ./INSTALL
|
||||
libaio
|
||||
|
||||
# libblkid
|
||||
keyutils # libkeyutils
|
||||
lz4 # liblz4
|
||||
|
||||
libscrypt
|
||||
libsodium
|
||||
liburcu
|
||||
libuuid
|
||||
zstd # libzstd
|
||||
zlib # zlib1g
|
||||
valgrind
|
||||
|
||||
# unspecified dependencies
|
||||
attr
|
||||
udev
|
||||
|
||||
# documentation depenedencies
|
||||
docutils
|
||||
python39Packages.pygments
|
||||
] ++ (lib.optional fuseSupport fuse3)
|
||||
++ (lib.optional testWithValgrind valgrind) ;
|
||||
|
||||
makeFlags = [
|
||||
"PREFIX=${placeholder "out"}"
|
||||
] ++ lib.optional debugMode "EXTRA_CFLAGS=-ggdb";
|
||||
|
||||
installFlags = [
|
||||
"INITRAMFS_DIR=${placeholder "out"}/etc/initramfs-tools"
|
||||
];
|
||||
|
||||
doCheck = true; # needs bcachefs module loaded on builder
|
||||
|
||||
checkInputs = [
|
||||
python39Packages.pytest
|
||||
python39Packages.pytest-xdist
|
||||
] ++ lib.optional testWithValgrind valgrind;
|
||||
|
||||
checkFlags = [
|
||||
"BCACHEFS_TEST_USE_VALGRIND=${if testWithValgrind then "yes" else "no"}"
|
||||
# cannot escape spaces within make flags, quotes are stripped
|
||||
"PYTEST=pytest" # "PYTEST_ARGS='-n4 --version'"
|
||||
];
|
||||
|
||||
preCheck =
|
||||
''
|
||||
makeFlagsArray+=(PYTEST_ARGS="--verbose -n4")
|
||||
'' +
|
||||
lib.optionalString fuseSupport ''
|
||||
rm tests/test_fuse.py
|
||||
'';
|
||||
|
||||
dontStrip = debugMode == true;
|
||||
passthru = {
|
||||
bcachefs_revision = let
|
||||
file = builtins.readFile ./.bcachefs_revision;
|
||||
removeLineFeeds = str: lib.lists.foldr (lib.strings.removeSuffix) str ["\r" "\n"];
|
||||
in removeLineFeeds file;
|
||||
|
||||
tests = {
|
||||
smoke-test = nixosTests.bcachefs;
|
||||
};
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
meta = with lib; {
|
||||
description = "Userspace tools for bcachefs";
|
||||
homepage = http://bcachefs.org;
|
||||
license = licenses.gpl2;
|
||||
platforms = platforms.linux;
|
||||
maintainers =
|
||||
[ "Kent Overstreet <kent.overstreet@gmail.com>"
|
||||
];
|
||||
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user