From 73570ddb89ad28f8815e61aceb2f12f2df686175 Mon Sep 17 00:00:00 2001 From: Stella Date: Sat, 16 Jul 2022 14:39:57 +0300 Subject: [PATCH] dwarfs: init at 0.6.1 Co-authored-by: Thomas --- pkgs/tools/filesystems/dwarfs/default.nix | 103 ++++++++++++++++++ .../filesystems/dwarfs/version_info.patch | 40 +++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 145 insertions(+) create mode 100644 pkgs/tools/filesystems/dwarfs/default.nix create mode 100644 pkgs/tools/filesystems/dwarfs/version_info.patch diff --git a/pkgs/tools/filesystems/dwarfs/default.nix b/pkgs/tools/filesystems/dwarfs/default.nix new file mode 100644 index 000000000000..22b29b5ed27f --- /dev/null +++ b/pkgs/tools/filesystems/dwarfs/default.nix @@ -0,0 +1,103 @@ +{ lib +, fetchFromGitHub +, stdenv +, substituteAll + +, bison +, boost +, cmake +, double-conversion +, fmt_8 +, fuse3 +, gflags +, glog +, gtest +, jemalloc +, libarchive +, libevent +, libunwind +, lz4 +, openssl +, pkg-config +, ronn +, xxHash +, zstd +}: + +stdenv.mkDerivation rec { + pname = "dwarfs"; + version = "0.6.1"; + + src = fetchFromGitHub { + owner = "mhx"; + repo = "dwarfs"; + rev = "v${version}"; + fetchSubmodules = true; + sha256 = "sha256-bGJkgcq8JxueRTX08QpJv1A0O5wXbiIgUY7BrY0Ln/M="; + }; + + patches = with lib.versions; [ + (substituteAll { + src = ./version_info.patch; + + gitRev = "v${version}"; + gitDesc = "v${version}"; + gitBranch = "v${version}"; + gitId = "v${version}"; # displayed as version number + + versionMajor = major version; + versionMinor = minor version; + versionPatch = patch version; + }) + ]; + + cmakeFlags = [ + "-DPREFER_SYSTEM_ZSTD=ON" + "-DPREFER_SYSTEM_XXHASH=ON" + "-DPREFER_SYSTEM_GTEST=ON" + + # may be added under an option in the future + # "-DWITH_LEGACY_FUSE=ON" + "-DWITH_TESTS=ON" + ]; + + nativeBuildInputs = [ + bison + cmake + pkg-config + ronn + ]; + + buildInputs = [ + # dwarfs + boost + fmt_8 + fuse3 + jemalloc + libarchive + lz4 + xxHash + zstd + + # folly + double-conversion + glog + libevent + libunwind + openssl + ]; + + doCheck = true; + checkInputs = [ gtest ]; + # this fails inside of the sandbox due to missing access + # to the FUSE device + GTEST_FILTER = "-tools.everything"; + + meta = with lib; { + description = "A fast high compression read-only file system"; + homepage = "https://github.com/mhx/dwarfs"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ keksbg ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/tools/filesystems/dwarfs/version_info.patch b/pkgs/tools/filesystems/dwarfs/version_info.patch new file mode 100644 index 000000000000..59936302ace0 --- /dev/null +++ b/pkgs/tools/filesystems/dwarfs/version_info.patch @@ -0,0 +1,40 @@ +diff --git a/include/dwarfs/version.h b/include/dwarfs/version.h +new file mode 100755 +index 0000000..9b12c59 +--- /dev/null ++++ b/include/dwarfs/version.h +@@ -0,0 +1,16 @@ ++// autogenerated code, do not modify ++ ++#pragma once ++ ++#define PRJ_VERSION_MAJOR @versionMajor@ ++#define PRJ_VERSION_MINOR @versionMinor@ ++#define PRJ_VERSION_PATCH @versionPatch@ ++ ++namespace dwarfs { ++ ++extern char const* PRJ_GIT_REV; ++extern char const* PRJ_GIT_DESC; ++extern char const* PRJ_GIT_BRANCH; ++extern char const* PRJ_GIT_ID; ++ ++} // namespace dwarfs +diff --git a/src/dwarfs/version.cpp b/src/dwarfs/version.cpp +new file mode 100755 +index 0000000..3af0215 +--- /dev/null ++++ b/src/dwarfs/version.cpp +@@ -0,0 +1,12 @@ ++// autogenerated code, do not modify ++ ++#include "dwarfs/version.h" ++ ++namespace dwarfs { ++ ++char const* PRJ_GIT_REV = "@gitRev@"; ++char const* PRJ_GIT_DESC = "@gitDesc@"; ++char const* PRJ_GIT_BRANCH = "@gitBranch@"; ++char const* PRJ_GIT_ID = "@gitId@"; ++ ++} // namespace dwarfs diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6ea50d2fc5ba..06383cbdf7bd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1187,6 +1187,8 @@ with pkgs; davinci-resolve = callPackage ../applications/video/davinci-resolve { }; + dwarfs = callPackage ../tools/filesystems/dwarfs { }; + gamemode = callPackage ../tools/games/gamemode { libgamemode32 = pkgsi686Linux.gamemode.lib; };