nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 fetchpatch,
6 pkg-config,
7 rocksdb,
8 boost,
9 fuse3,
10 lib45d,
11 tbb_2021,
12 liburing,
13 installShellFiles,
14}:
15stdenv.mkDerivation (finalAttrs: {
16 name = "autotier";
17 version = "1.2.0";
18 src = fetchFromGitHub {
19 owner = "45Drives";
20 repo = "autotier";
21 tag = "v${finalAttrs.version}";
22 hash = "sha256-Pf1baDJsyt0ScASWrrgMu8+X5eZPGJSu0/LDQNHe1Ok=";
23 };
24
25 patches = [
26 # https://github.com/45Drives/autotier/pull/70
27 # fix "error: 'uintmax_t' has not been declared" build failure until next release
28 (fetchpatch {
29 url = "https://github.com/45Drives/autotier/commit/d447929dc4262f607d87cbc8ad40a54d64f5011a.patch";
30 hash = "sha256-0ab8YBgdJMxBHfOgUsgPpyUE1GyhAU3+WCYjYA2pjqo=";
31 })
32 # Unvendor rocksdb (nixpkgs already applies RTTI and PORTABLE flags) and use pkg-config for flags
33 (fetchpatch {
34 url = "https://github.com/45Drives/autotier/commit/fa282f5079ff17c144a7303d64dad0e44681b87f.patch";
35 hash = "sha256-+W3RwSe8zJKgZIXOaawHuI6xRzedYIcZundPC8eHuwM=";
36 })
37 # Add missing list import to src/incl/config.hpp
38 (fetchpatch {
39 url = "https://github.com/45Drives/autotier/commit/1f97703f4dfbfe093f5c18c4ee01dcc1c8fe04f3.patch";
40 hash = "sha256-3+KOh7JvbujCMbMqnZ5SGopAuOKHitKq6XV6a/jkcog=";
41 })
42 ];
43
44 buildInputs = [
45 rocksdb
46 boost
47 fuse3
48 lib45d
49 tbb_2021
50 liburing
51 ];
52
53 nativeBuildInputs = [
54 pkg-config
55 installShellFiles
56 ];
57
58 installPhase = ''
59 runHook preInstall
60
61 # binaries
62 installBin dist/from_source/*
63
64 # docs
65 installManPage doc/man/autotier.8
66
67 # Completions
68 installShellCompletion --bash doc/completion/autotier.bash-completion
69 installShellCompletion --bash doc/completion/autotierfs.bash-completion
70
71 # Scripts
72 installBin script/autotier-init-dirs
73
74 # Default config
75 install -Dm755 -t $out/etc/autotier.conf doc/autotier.conf.template
76
77 runHook postInstall
78 '';
79
80 meta = {
81 homepage = "https://github.com/45Drives/autotier";
82 description = "Passthrough FUSE filesystem that intelligently moves files between storage tiers based on frequency of use, file age, and tier fullness";
83 license = lib.licenses.gpl3;
84 maintainers = with lib.maintainers; [ philipwilk ];
85 mainProgram = "autotier"; # cli, for file system use autotierfs
86 platforms = lib.platforms.linux; # uses io_uring so only available on linux not unix
87 };
88})