about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeder Bergebakken Sundt <pbsds@hotmail.com>2023-12-08 02:14:17 +0100
committerGitHub <noreply@github.com>2023-12-08 02:14:17 +0100
commit09dc04054ba2ff1f861357d0e7e76d021b273cd7 (patch)
treeb69d080b4eb43897ad5a7af52f66cea3a9a4dc14
parent1a009a93fcd7bc47ffb621cee759e0e11c569e75 (diff)
parent810da0480b8bf24b1a2f2e0278494cceb5f31964 (diff)
downloadnixlib-09dc04054ba2ff1f861357d0e7e76d021b273cd7.tar
nixlib-09dc04054ba2ff1f861357d0e7e76d021b273cd7.tar.gz
nixlib-09dc04054ba2ff1f861357d0e7e76d021b273cd7.tar.bz2
nixlib-09dc04054ba2ff1f861357d0e7e76d021b273cd7.tar.lz
nixlib-09dc04054ba2ff1f861357d0e7e76d021b273cd7.tar.xz
nixlib-09dc04054ba2ff1f861357d0e7e76d021b273cd7.tar.zst
nixlib-09dc04054ba2ff1f861357d0e7e76d021b273cd7.zip
Merge pull request #251465 from gracicot/grc/init-vcpkg
vcpkg: init at 2023.10.19
-rw-r--r--maintainers/maintainer-list.nix11
-rw-r--r--pkgs/by-name/cm/cmakerc/package.nix32
-rw-r--r--pkgs/by-name/vc/vcpkg-tool/change-lock-location.patch14
-rw-r--r--pkgs/by-name/vc/vcpkg-tool/package.nix73
-rw-r--r--pkgs/by-name/vc/vcpkg/package.nix51
-rw-r--r--pkgs/top-level/all-packages.nix4
6 files changed, 185 insertions, 0 deletions
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 8e47896f003a..c5ff33f5dd17 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -6834,6 +6834,12 @@
     githubId = 6893840;
     name = "Yacine Hmito";
   };
+  gracicot = {
+    email = "gracicot42@gmail.com";
+    github = "gracicot";
+    githubId = 2906673;
+    name = "Guillaume Racicot";
+  };
   graham33 = {
     email = "graham@grahambennett.org";
     github = "graham33";
@@ -6939,6 +6945,11 @@
     githubId = 21156405;
     name = "GuangTao Zhang";
   };
+  guekka = {
+    github = "Guekka";
+    githubId = 39066502;
+    name = "Guekka";
+  };
   guibert = {
     email = "david.guibert@gmail.com";
     github = "dguibert";
diff --git a/pkgs/by-name/cm/cmakerc/package.nix b/pkgs/by-name/cm/cmakerc/package.nix
new file mode 100644
index 000000000000..cf96ae46db5e
--- /dev/null
+++ b/pkgs/by-name/cm/cmakerc/package.nix
@@ -0,0 +1,32 @@
+{ lib
+, stdenvNoCC
+, fetchFromGitHub
+}:
+
+stdenvNoCC.mkDerivation (finalAttrs: {
+  pname = "cmrc";
+  version = "2.0.1";
+
+  src = fetchFromGitHub {
+    owner = "vector-of-bool";
+    repo = "cmrc";
+    rev = finalAttrs.version;
+    hash = "sha256-++16WAs2K9BKk8384yaSI/YD1CdtdyXVBIjGhqi4JIk=";
+  };
+
+  installPhase = ''
+    runHook preInstall
+
+    install CMakeRC.cmake -DT $out/share/cmakerc/cmakerc-config.cmake
+
+    runHook postInstall
+  '';
+
+  meta = {
+    description = "A Resource Compiler in a Single CMake Script";
+    homepage = "https://github.com/vector-of-bool/cmrc";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ guekka ];
+    platforms = lib.platforms.all;
+  };
+})
diff --git a/pkgs/by-name/vc/vcpkg-tool/change-lock-location.patch b/pkgs/by-name/vc/vcpkg-tool/change-lock-location.patch
new file mode 100644
index 000000000000..d3cf8e0f8137
--- /dev/null
+++ b/pkgs/by-name/vc/vcpkg-tool/change-lock-location.patch
@@ -0,0 +1,14 @@
+diff --git a/src/vcpkg/vcpkgpaths.cpp b/src/vcpkg/vcpkgpaths.cpp
+index 3f588c21..e6f2bbed 100644
+--- a/src/vcpkg/vcpkgpaths.cpp
++++ b/src/vcpkg/vcpkgpaths.cpp
+@@ -579,7 +579,8 @@ namespace vcpkg
+                 if (!args.do_not_take_lock)
+                 {
+                     std::error_code ec;
+-                    const auto vcpkg_root_file = root / ".vcpkg-root";
++                    fs.create_directories(Path{"/tmp/vcpkg"}, VCPKG_LINE_INFO);
++                    const auto vcpkg_root_file = Path{"/tmp/vcpkg"} / Hash::get_string_sha256(root.c_str());
+                     if (args.wait_for_lock.value_or(false))
+                     {
+                         file_lock_handle = fs.take_exclusive_file_lock(vcpkg_root_file, ec);
diff --git a/pkgs/by-name/vc/vcpkg-tool/package.nix b/pkgs/by-name/vc/vcpkg-tool/package.nix
new file mode 100644
index 000000000000..0dbeac164369
--- /dev/null
+++ b/pkgs/by-name/vc/vcpkg-tool/package.nix
@@ -0,0 +1,73 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, cacert
+, cmake
+, cmakerc
+, fmt
+, git
+, gzip
+, makeWrapper
+, meson
+, ninja
+, openssh
+, python3
+, zip
+, zstd
+, extraRuntimeDeps ? []
+}:
+stdenv.mkDerivation (finalAttrs: {
+  pname = "vcpkg-tool";
+  version = "2023-10-18";
+
+  src = fetchFromGitHub {
+    owner = "microsoft";
+    repo = "vcpkg-tool";
+    rev = finalAttrs.version;
+    hash = "sha256-Hm+GSKov9A6tmN10BHOTVy8aWkLOJNBMOQJNm4HnWuI=";
+  };
+
+  nativeBuildInputs = [
+    cmake
+    cmakerc
+    fmt
+    ninja
+    makeWrapper
+  ];
+
+  patches = [
+    ./change-lock-location.patch
+  ];
+
+  cmakeFlags = [
+    "-DVCPKG_DEPENDENCY_EXTERNAL_FMT=ON"
+    "-DVCPKG_DEPENDENCY_CMAKERC=ON"
+  ];
+
+  postFixup = let
+    # These are the most common binaries used by vcpkg
+    # Extra binaries can be added via overlay when needed
+    runtimeDeps = [
+      cacert
+      cmake
+      git
+      gzip
+      meson
+      ninja
+      openssh
+      python3
+      zip
+      zstd
+    ] ++ extraRuntimeDeps;
+  in ''
+    wrapProgram $out/bin/vcpkg --prefix PATH ${lib.makeBinPath runtimeDeps}
+  '';
+
+  meta = {
+    description = "Components of microsoft/vcpkg's binary";
+    homepage = "https://github.com/microsoft/vcpkg-tool";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ guekka gracicot ];
+    platforms = lib.platforms.all;
+  };
+})
diff --git a/pkgs/by-name/vc/vcpkg/package.nix b/pkgs/by-name/vc/vcpkg/package.nix
new file mode 100644
index 000000000000..e8beeb0756a1
--- /dev/null
+++ b/pkgs/by-name/vc/vcpkg/package.nix
@@ -0,0 +1,51 @@
+{ fetchFromGitHub
+, stdenvNoCC
+, lib
+, vcpkg-tool
+, writeShellScript
+}:
+
+stdenvNoCC.mkDerivation (finalAttrs: {
+  pname = "vcpkg";
+  version = "2023.10.19";
+
+  src = fetchFromGitHub {
+    owner = "microsoft";
+    repo = "vcpkg";
+    rev = finalAttrs.version;
+    hash = "sha256-u+4vyOphnowoaZgfkCbzF7Q4tuz2GN1bHylaKw352Lc=";
+  };
+
+  installPhase = let
+    # vcpkg needs two directories to write to that is independent of installation directory.
+    # Since vcpkg already creates $HOME/.vcpkg/ we use that to create a root where vcpkg can write into.
+    vcpkgScript = writeShellScript "vcpkg" ''
+      vcpkg_writable_path="$HOME/.vcpkg/root/"
+
+      VCPKG_ROOT="@out@/share/vcpkg" ${vcpkg-tool}/bin/vcpkg \
+        --x-downloads-root="$vcpkg_writable_path"/downloads \
+        --x-buildtrees-root="$vcpkg_writable_path"/buildtrees \
+        --x-packages-root="$vcpkg_writable_path"/packages \
+        "$@"
+      '';
+    in ''
+      runHook preInstall
+
+      mkdir -p $out/bin $out/share/vcpkg/scripts/buildsystems
+      cp --preserve=mode -r ./{docs,ports,triplets,scripts,.vcpkg-root,versions,LICENSE.txt} $out/share/vcpkg/
+      substitute ${vcpkgScript} $out/bin/vcpkg --subst-var-by out $out
+      chmod +x $out/bin/vcpkg
+      ln -s $out/bin/vcpkg $out/share/vcpkg/vcpkg
+      touch $out/share/vcpkg/vcpkg.disable-metrics
+
+      runHook postInstall
+    '';
+
+  meta = {
+    description = "C++ Library Manager";
+    homepage = "https://vcpkg.io/";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ guekka gracicot ];
+    platforms = lib.platforms.all;
+  };
+})
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 2c459e130eac..89b34579b382 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -822,6 +822,10 @@ with pkgs;
 
   sea-orm-cli = callPackage ../development/tools/sea-orm-cli { };
 
+  vcpkg-tool = callPackage ../by-name/vc/vcpkg-tool/package.nix {
+    fmt = fmt_10;
+  };
+
   r3ctl = qt5.callPackage ../tools/misc/r3ctl { };
 
   ptouch-print = callPackage ../misc/ptouch-print { };