diff options
Diffstat (limited to 'nixpkgs/pkgs/by-name/tu')
7 files changed, 265 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/by-name/tu/tup/fusermount-setuid.patch b/nixpkgs/pkgs/by-name/tu/tup/fusermount-setuid.patch new file mode 100644 index 000000000000..34b77ab8659a --- /dev/null +++ b/nixpkgs/pkgs/by-name/tu/tup/fusermount-setuid.patch @@ -0,0 +1,31 @@ +# Tup needs a setuid fusermount which may be outside $PATH. + +diff --git a/src/tup/server/fuse_server.c b/src/tup/server/fuse_server.c +index d4ab648d..2dc9294b 100644 +--- a/src/tup/server/fuse_server.c ++++ b/src/tup/server/fuse_server.c +@@ -105,16 +105,21 @@ static void *fuse_thread(void *arg) + #if defined(__linux__) + static int os_unmount(void) + { +- int rc; + #ifdef FUSE3 +- rc = system("fusermount3 -u -z " TUP_MNT); ++#define FUSERMOUNT "fusermount3" + #else +- rc = system("fusermount -u -z " TUP_MNT); ++#define FUSERMOUNT "fusermount" + #endif ++ int rc; ++ const char *cmd = (access("/run/wrappers/bin/" FUSERMOUNT, X_OK) == 0) ++ ? "/run/wrappers/bin/" FUSERMOUNT " -u -z " TUP_MNT ++ : FUSERMOUNT " -u -z " TUP_MNT; ++ rc = system(cmd); + if(rc == -1) { + perror("system"); + } + return rc; ++#undef FUSERMOUNT + } + #elif defined(__APPLE__) + static int os_unmount(void) diff --git a/nixpkgs/pkgs/by-name/tu/tup/package.nix b/nixpkgs/pkgs/by-name/tu/tup/package.nix new file mode 100644 index 000000000000..902508129cb2 --- /dev/null +++ b/nixpkgs/pkgs/by-name/tu/tup/package.nix @@ -0,0 +1,81 @@ +{ lib, stdenv, fetchFromGitHub, fuse3, macfuse-stubs, pkg-config, sqlite, pcre }: + +let + fuse = if stdenv.isDarwin then macfuse-stubs else fuse3; +in stdenv.mkDerivation rec { + pname = "tup"; + version = "0.7.11"; + outputs = [ "bin" "man" "out" ]; + + src = fetchFromGitHub { + owner = "gittup"; + repo = "tup"; + rev = "v${version}"; + hash = "sha256-Q2Y5ErcfhLChi9Wezn8+7eNXYX2UXW1fBOqEclmgzOo="; + }; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ fuse pcre sqlite ]; + + patches = [ ./fusermount-setuid.patch ]; + + configurePhase = '' + substituteInPlace src/tup/link.sh --replace '`git describe' '`echo ${version}' + + for f in Tupfile Tuprules.tup src/tup/server/Tupfile build.sh; do + substituteInPlace "$f" \ + --replace "pkg-config" "${stdenv.cc.targetPrefix}pkg-config" \ + --replace "pcre-config" "${stdenv.cc.targetPrefix}pkg-config libpcre" + done + + cat << EOF > tup.config + CONFIG_CC=${stdenv.cc.targetPrefix}cc + CONFIG_AR=${stdenv.cc.targetPrefix}ar + CONFIG_TUP_USE_SYSTEM_SQLITE=y + EOF + ''; + + # Regular tup builds require fusermount to have suid, which nix cannot + # currently provide in a build environment, so we bootstrap and use 'tup + # generate' instead + buildPhase = '' + runHook preBuild + ./build.sh + ./build/tup init + ./build/tup generate script.sh + ./script.sh + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + install -D tup -t $bin/bin/ + install -D tup.1 -t $man/share/man/man1/ + runHook postInstall + ''; + + setupHook = ./setup-hook.sh; + + meta = with lib; { + description = "A fast, file-based build system"; + longDescription = '' + Tup is a file-based build system for Linux, OSX, and Windows. It inputs a list + of file changes and a directed acyclic graph (DAG), then processes the DAG to + execute the appropriate commands required to update dependent files. Updates are + performed with very little overhead since tup implements powerful build + algorithms to avoid doing unnecessary work. This means you can stay focused on + your project rather than on your build system. + ''; + homepage = "https://gittup.org/tup/"; + license = licenses.gpl2; + maintainers = with maintainers; [ ehmry ]; + platforms = platforms.unix; + + # TODO: Remove once nixpkgs uses newer SDKs that supports '*at' functions. + # Probably MacOS SDK 10.13 or later. Check the current version in + # ../../../../os-specific/darwin/apple-sdk/default.nix + # + # https://github.com/gittup/tup/commit/3697c74 + broken = stdenv.isDarwin; + }; +} diff --git a/nixpkgs/pkgs/by-name/tu/tup/setup-hook.sh b/nixpkgs/pkgs/by-name/tu/tup/setup-hook.sh new file mode 100644 index 000000000000..a9fbf35c32f8 --- /dev/null +++ b/nixpkgs/pkgs/by-name/tu/tup/setup-hook.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +tupConfigure() { + echo -n CONFIG_TUP_ARCH= >> tup.config + case "$system" in + "i686-*") echo i386 >> tup.config;; + "x86_64-*") echo x86_64 >> tup.config;; + "powerpc-*") echo powerpc >> tup.config;; + "powerpc64-*") echo powerpc64 >> tup.config;; + "ia64-*") echo ia64 >> tup.config;; + "alpha-*") echo alpha >> tup.config;; + "sparc-*") echo sparc >> tup.config;; + "aarch64-*") echo arm64 >> tup.config;; + "arm*") echo arm >> tup.config;; + esac + + echo "${tupConfig-}" >> tup.config + + tup init + tup generate --verbose tupBuild.sh +} + +tupConfigurePhase() { + runHook preConfigure + tupConfigure + runHook postConfigure +} + +if [ -z "${dontUseTupConfigure-}" -a -z "${configurePhase-}" ]; then + configurePhase=tupConfigurePhase +fi + +tupBuild() { + pushd . + ./tupBuild.sh + popd +} + +tupBuildPhase() { + runHook preBuild + tupBuild + runHook postBuild +} + +if [ -z "${dontUseTupBuild-}" -a -z "${buildPhase-}" ]; then + buildPhase=tupBuildPhase +fi diff --git a/nixpkgs/pkgs/by-name/tu/tuxclocker-nvidia-plugin/no-cpu-plugin.patch b/nixpkgs/pkgs/by-name/tu/tuxclocker-nvidia-plugin/no-cpu-plugin.patch new file mode 100644 index 000000000000..d6d864fb9789 --- /dev/null +++ b/nixpkgs/pkgs/by-name/tu/tuxclocker-nvidia-plugin/no-cpu-plugin.patch @@ -0,0 +1,14 @@ +diff --git a/src/plugins/meson.build b/src/plugins/meson.build +index cdd3b5b..a5a2174 100644 +--- a/src/plugins/meson.build ++++ b/src/plugins/meson.build +@@ -63,9 +63,3 @@ if all_nvidia_linux_libs + install : true, + link_with : libtuxclocker) + endif +- +-shared_library('cpu', 'CPU.cpp', 'Utils.cpp', +- include_directories : [incdir, fplus_inc], +- install_dir : get_option('libdir') / 'tuxclocker' / 'plugins', +- install : true, +- link_with : libtuxclocker) diff --git a/nixpkgs/pkgs/by-name/tu/tuxclocker-nvidia-plugin/package.nix b/nixpkgs/pkgs/by-name/tu/tuxclocker-nvidia-plugin/package.nix new file mode 100644 index 000000000000..dac3b342c4c2 --- /dev/null +++ b/nixpkgs/pkgs/by-name/tu/tuxclocker-nvidia-plugin/package.nix @@ -0,0 +1,34 @@ +{ lib +, stdenv +, boost +, libX11 +, libXext +, linuxPackages +, openssl +, tuxclocker-plugins +}: + +stdenv.mkDerivation { + pname = "tuxclocker-nvidia-plugin"; + + inherit (tuxclocker-plugins) src version meta BOOST_INCLUDEDIR BOOST_LIBRARYDIR nativeBuildInputs; + + buildInputs = [ + boost + libX11 + libXext + linuxPackages.nvidia_x11 + linuxPackages.nvidia_x11.settings.libXNVCtrl + openssl + ]; + + # Build doesn't have a way to disable building the CPU plugin, which is already + # provided by 'tuxclocker-plugins' + patches = [ ./no-cpu-plugin.patch ]; + + mesonFlags = [ + "-Ddaemon=false" + "-Dgui=false" + "-Drequire-nvidia=true" + ]; +} diff --git a/nixpkgs/pkgs/by-name/tu/tuxclocker-plugins-with-unfree/package.nix b/nixpkgs/pkgs/by-name/tu/tuxclocker-plugins-with-unfree/package.nix new file mode 100644 index 000000000000..f055cf111fa3 --- /dev/null +++ b/nixpkgs/pkgs/by-name/tu/tuxclocker-plugins-with-unfree/package.nix @@ -0,0 +1,16 @@ +{ symlinkJoin +, tuxclocker-nvidia-plugin +, tuxclocker-plugins +}: + +symlinkJoin rec { + inherit (tuxclocker-plugins) version meta; + + pname = "tuxclocker-plugins-with-unfree"; + name = "${pname}-${version}"; + + paths = [ + tuxclocker-nvidia-plugin + tuxclocker-plugins + ]; +} diff --git a/nixpkgs/pkgs/by-name/tu/tuxclocker-plugins/package.nix b/nixpkgs/pkgs/by-name/tu/tuxclocker-plugins/package.nix new file mode 100644 index 000000000000..19c8fa52441b --- /dev/null +++ b/nixpkgs/pkgs/by-name/tu/tuxclocker-plugins/package.nix @@ -0,0 +1,42 @@ +{ lib +, stdenv +, boost +, cmake +, gettext +, git +, libdrm +, meson +, ninja +, openssl +, pkg-config +, python3 +, tuxclocker +}: + +stdenv.mkDerivation { + inherit (tuxclocker) src version meta BOOST_INCLUDEDIR BOOST_LIBRARYDIR; + + pname = "tuxclocker-plugins"; + + nativeBuildInputs = [ + gettext + git + meson + ninja + pkg-config + (python3.withPackages(p: [ p.hwdata ])) + ]; + + buildInputs = [ + boost + libdrm + openssl + ]; + + mesonFlags = [ + "-Ddaemon=false" + "-Dgui=false" + "-Drequire-amd=true" + "-Drequire-python-hwdata=true" + ]; +} |