Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchFromGitHub, fuse3, macfuse-stubs, pkg-config, sqlite, pcre }: 2 3let 4 fuse = if stdenv.isDarwin then macfuse-stubs else fuse3; 5in stdenv.mkDerivation rec { 6 pname = "tup"; 7 version = "0.7.11"; 8 outputs = [ "bin" "man" "out" ]; 9 10 src = fetchFromGitHub { 11 owner = "gittup"; 12 repo = "tup"; 13 rev = "v${version}"; 14 hash = "sha256-Q2Y5ErcfhLChi9Wezn8+7eNXYX2UXW1fBOqEclmgzOo="; 15 }; 16 17 nativeBuildInputs = [ pkg-config ]; 18 buildInputs = [ fuse pcre sqlite ]; 19 20 patches = [ ./fusermount-setuid.patch ]; 21 22 configurePhase = '' 23 substituteInPlace src/tup/link.sh --replace '`git describe' '`echo ${version}' 24 25 for f in Tupfile Tuprules.tup src/tup/server/Tupfile build.sh; do 26 substituteInPlace "$f" \ 27 --replace "pkg-config" "${stdenv.cc.targetPrefix}pkg-config" \ 28 --replace "pcre-config" "${stdenv.cc.targetPrefix}pkg-config libpcre" 29 done 30 31 cat << EOF > tup.config 32 CONFIG_CC=${stdenv.cc.targetPrefix}cc 33 CONFIG_AR=${stdenv.cc.targetPrefix}ar 34 CONFIG_TUP_USE_SYSTEM_SQLITE=y 35 EOF 36 ''; 37 38 # Regular tup builds require fusermount to have suid, which nix cannot 39 # currently provide in a build environment, so we bootstrap and use 'tup 40 # generate' instead 41 buildPhase = '' 42 runHook preBuild 43 ./build.sh 44 ./build/tup init 45 ./build/tup generate script.sh 46 ./script.sh 47 runHook postBuild 48 ''; 49 50 installPhase = '' 51 runHook preInstall 52 install -D tup -t $bin/bin/ 53 install -D tup.1 -t $man/share/man/man1/ 54 runHook postInstall 55 ''; 56 57 setupHook = ./setup-hook.sh; 58 59 meta = with lib; { 60 description = "A fast, file-based build system"; 61 longDescription = '' 62 Tup is a file-based build system for Linux, OSX, and Windows. It inputs a list 63 of file changes and a directed acyclic graph (DAG), then processes the DAG to 64 execute the appropriate commands required to update dependent files. Updates are 65 performed with very little overhead since tup implements powerful build 66 algorithms to avoid doing unnecessary work. This means you can stay focused on 67 your project rather than on your build system. 68 ''; 69 homepage = "https://gittup.org/tup/"; 70 license = licenses.gpl2; 71 maintainers = with maintainers; [ ehmry ]; 72 platforms = platforms.unix; 73 74 # TODO: Remove once nixpkgs uses newer SDKs that supports '*at' functions. 75 # Probably MacOS SDK 10.13 or later. Check the current version in 76 # ../../../../os-specific/darwin/apple-sdk/default.nix 77 # 78 # https://github.com/gittup/tup/commit/3697c74 79 broken = stdenv.isDarwin; 80 }; 81}