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 onetbb,
12 liburing,
13 installShellFiles,
14}:
15stdenv.mkDerivation (finalAttrs: {
16 pname = "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 # Required by rocksdb after 10.7.5
45 env.EXTRA_CFLAGS = "-std=c++20 -fno-char8_t";
46
47 buildInputs = [
48 rocksdb
49 boost
50 fuse3
51 lib45d
52 onetbb
53 liburing
54 ];
55
56 nativeBuildInputs = [
57 pkg-config
58 installShellFiles
59 ];
60
61 installPhase = ''
62 runHook preInstall
63
64 # binaries
65 installBin dist/from_source/*
66
67 # docs
68 installManPage doc/man/autotier.8
69
70 # Completions
71 installShellCompletion --bash doc/completion/autotier.bash-completion
72 installShellCompletion --bash doc/completion/autotierfs.bash-completion
73
74 # Scripts
75 installBin script/autotier-init-dirs
76
77 # Default config
78 install -Dm755 -t $out/etc/autotier.conf doc/autotier.conf.template
79
80 runHook postInstall
81 '';
82
83 meta = {
84 homepage = "https://github.com/45Drives/autotier";
85 description = "Passthrough FUSE filesystem that intelligently moves files between storage tiers based on frequency of use, file age, and tier fullness";
86 license = lib.licenses.gpl3;
87 maintainers = with lib.maintainers; [ philipwilk ];
88 mainProgram = "autotier"; # cli, for file system use autotierfs
89 platforms = lib.platforms.linux; # uses io_uring so only available on linux not unix
90 };
91})