about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/interpreters
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/interpreters')
-rw-r--r--nixpkgs/pkgs/development/interpreters/babashka/default.nix4
-rw-r--r--nixpkgs/pkgs/development/interpreters/jruby/default.nix4
-rw-r--r--nixpkgs/pkgs/development/interpreters/lua-5/build-luarocks-package.nix40
-rw-r--r--nixpkgs/pkgs/development/interpreters/luau/default.nix4
-rw-r--r--nixpkgs/pkgs/development/interpreters/maude/default.nix1
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/catch_conflicts/catch_conflicts.py73
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/cpython/default.nix3
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/default.nix8
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/hooks/default.nix6
-rw-r--r--nixpkgs/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook-tests.nix137
-rw-r--r--nixpkgs/pkgs/development/interpreters/ruby/default.nix4
-rw-r--r--nixpkgs/pkgs/development/interpreters/ruby/rubygems/default.nix4
-rw-r--r--nixpkgs/pkgs/development/interpreters/wasmtime/default.nix6
13 files changed, 248 insertions, 46 deletions
diff --git a/nixpkgs/pkgs/development/interpreters/babashka/default.nix b/nixpkgs/pkgs/development/interpreters/babashka/default.nix
index 99528c2d7639..9844920366c7 100644
--- a/nixpkgs/pkgs/development/interpreters/babashka/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/babashka/default.nix
@@ -9,11 +9,11 @@
 let
   babashka-unwrapped = buildGraalvmNativeImage rec {
     pname = "babashka-unwrapped";
-    version = "1.3.188";
+    version = "1.3.189";
 
     src = fetchurl {
       url = "https://github.com/babashka/babashka/releases/download/v${version}/babashka-${version}-standalone.jar";
-      sha256 = "sha256-EjsSUPWiLQcCos2oyVXt3VzLlGEfiXK5CqJZ1NMvF/E=";
+      sha256 = "sha256-C3N++tTTvebtQid3p+zrnBgHTqQmECQhiS2/3VIEojI=";
     };
 
     graalvmDrv = graalvmCEPackages.graalvm-ce;
diff --git a/nixpkgs/pkgs/development/interpreters/jruby/default.nix b/nixpkgs/pkgs/development/interpreters/jruby/default.nix
index f1cc624b59e7..5f31e8ef29ee 100644
--- a/nixpkgs/pkgs/development/interpreters/jruby/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/jruby/default.nix
@@ -6,11 +6,11 @@ let
 in
 stdenv.mkDerivation (finalAttrs: {
   pname = "jruby";
-  version = "9.4.5.0";
+  version = "9.4.6.0";
 
   src = fetchurl {
     url = "https://s3.amazonaws.com/jruby.org/downloads/${finalAttrs.version}/jruby-bin-${finalAttrs.version}.tar.gz";
-    hash = "sha256-pA94xGQczIZ1Lhay2iR/1ryfvPmkhkzxvjb3/3s1aEw=";
+    hash = "sha256-LaFN5BUrcf2/o1ukaHpG7xLNRldAM3tUnMH+bHwTmBM=";
   };
 
   nativeBuildInputs = [ makeBinaryWrapper ];
diff --git a/nixpkgs/pkgs/development/interpreters/lua-5/build-luarocks-package.nix b/nixpkgs/pkgs/development/interpreters/lua-5/build-luarocks-package.nix
index ea46fd107980..97ac535c9303 100644
--- a/nixpkgs/pkgs/development/interpreters/lua-5/build-luarocks-package.nix
+++ b/nixpkgs/pkgs/development/interpreters/lua-5/build-luarocks-package.nix
@@ -51,9 +51,10 @@
 
 # Appended to the generated luarocks config
 , extraConfig ? ""
-# Inserted into the generated luarocks config in the "variables" table
-, extraVariables ? {}
-# The two above arguments have access to builder variables -- e.g. to $out
+
+# transparent mapping nix <-> lua used as LUAROCKS_CONFIG
+# Refer to https://github.com/luarocks/luarocks/wiki/Config-file-format for specs
+, luarocksConfig ? {}
 
 # relative to srcRoot, path to the rockspec to use when using rocks
 , rockspecFilename ? null
@@ -92,7 +93,7 @@ let
     luarocks
   ];
 
-  inherit doCheck extraVariables rockspecFilename knownRockspec externalDeps nativeCheckInputs;
+  inherit doCheck extraConfig rockspecFilename knownRockspec externalDeps nativeCheckInputs;
 
   buildInputs = let
     # example externalDeps': [ { name = "CRYPTO"; dep = pkgs.openssl; } ]
@@ -116,9 +117,18 @@ let
     text = self.luarocks_content;
   };
 
-  luarocks_content = let
-      externalDepsGenerated = lib.filter (drv: !drv ? luaModule)
-        (self.nativeBuildInputs ++ self.propagatedBuildInputs ++ self.buildInputs);
+  luarocks_content =
+      (lib.generators.toLua { asBindings = true; } self.luarocksConfig) +
+      ''
+
+      ${self.extraConfig}
+      '';
+
+  # TODO make it the default variable
+  luarocksConfig = let
+    externalDepsGenerated = lib.filter (drv: !drv ? luaModule)
+      (self.nativeBuildInputs ++ self.propagatedBuildInputs ++ self.buildInputs);
+
     generatedConfig = luaLib.generateLuarocksConfig {
       externalDeps = lib.unique (self.externalDeps ++ externalDepsGenerated);
       # Filter out the lua derivation itself from the Lua module dependency
@@ -126,13 +136,17 @@ let
       # luaLib.hasLuaModule
       requiredLuaRocks = lib.filter luaLib.hasLuaModule
         (lua.pkgs.requiredLuaModules (self.nativeBuildInputs ++ self.propagatedBuildInputs));
-      inherit (self) extraVariables rocksSubdir;
+      inherit (self) rocksSubdir;
     };
-    in
-      ''
-      ${generatedConfig}
-      ${extraConfig}
-      '';
+
+    luarocksConfig' = lib.recursiveUpdate luarocksConfig
+      (lib.optionalAttrs (attrs ? extraVariables) (lib.warn "extraVariables in buildLuarocksPackage is deprecated, use luarocksConfig instead"
+      {
+        variables = attrs.extraVariables;
+      }))
+    ;
+  in lib.recursiveUpdate generatedConfig luarocksConfig';
+
 
   configurePhase = ''
     runHook preConfigure
diff --git a/nixpkgs/pkgs/development/interpreters/luau/default.nix b/nixpkgs/pkgs/development/interpreters/luau/default.nix
index a3f368d77f48..2341f8a5c70e 100644
--- a/nixpkgs/pkgs/development/interpreters/luau/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/luau/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   pname = "luau";
-  version = "0.613";
+  version = "614";
 
   src = fetchFromGitHub {
     owner = "luau-lang";
     repo = "luau";
     rev = version;
-    hash = "sha256-L7D3NsTvPVf/s7FCljdrkHK3uSX12FIOpzZ66ullDIk=";
+    hash = "sha256-pM+KSb5jsoPLu2paQYNSdqly0ndbw98Sj2dvMZ7XqhQ=";
   };
 
   nativeBuildInputs = [ cmake ];
diff --git a/nixpkgs/pkgs/development/interpreters/maude/default.nix b/nixpkgs/pkgs/development/interpreters/maude/default.nix
index 7c08b795d6a5..9ec93157c49a 100644
--- a/nixpkgs/pkgs/development/interpreters/maude/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/maude/default.nix
@@ -56,7 +56,6 @@ stdenv.mkDerivation {
   enableParallelBuilding = true;
 
   meta = {
-    broken = stdenv.isDarwin;
     homepage = "http://maude.cs.illinois.edu/";
     description = "High-level specification language";
     license = lib.licenses.gpl2Plus;
diff --git a/nixpkgs/pkgs/development/interpreters/python/catch_conflicts/catch_conflicts.py b/nixpkgs/pkgs/development/interpreters/python/catch_conflicts/catch_conflicts.py
index d5c99e64751c..d4219192790b 100644
--- a/nixpkgs/pkgs/development/interpreters/python/catch_conflicts/catch_conflicts.py
+++ b/nixpkgs/pkgs/development/interpreters/python/catch_conflicts/catch_conflicts.py
@@ -2,28 +2,77 @@ from importlib.metadata import PathDistribution
 from pathlib import Path
 import collections
 import sys
+import os
+from typing import Dict, List, Tuple
+do_abort: bool = False
+packages: Dict[str, Dict[str, List[Dict[str, List[str]]]]] = collections.defaultdict(list)
+out_path: Path = Path(os.getenv("out"))
+version: Tuple[int, int] = sys.version_info
+site_packages_path: str = f'lib/python{version[0]}.{version[1]}/site-packages'
 
 
-do_abort = False
-packages = collections.defaultdict(list)
+def get_name(dist: PathDistribution) -> str:
+    return dist.metadata['name'].lower().replace('-', '_')
 
 
-for path in sys.path:
-    for dist_info in Path(path).glob("*.dist-info"):
-        dist = PathDistribution(dist_info)
+# pretty print a package
+def describe_package(dist: PathDistribution) -> str:
+    return f"{get_name(dist)} {dist.version} ({dist._path})"
 
-        packages[dist._normalized_name].append(
-            f"{dist._normalized_name} {dist.version} ({dist._path})"
-        )
 
+# pretty print a list of parents (dependency chain)
+def describe_parents(parents: List[str]) -> str:
+    if not parents:
+        return ""
+    return \
+        f"    dependency chain:\n      " \
+        + str(f"\n      ...depending on: ".join(parents))
 
-for name, duplicates in packages.items():
-    if len(duplicates) > 1:
+
+# inserts an entry into 'packages'
+def add_entry(name: str, version: str, store_path: str, parents: List[str]) -> None:
+    if name not in packages:
+        packages[name] = {}
+    if store_path not in packages[name]:
+        packages[name][store_path] = []
+    packages[name][store_path].append(dict(
+        version=version,
+        parents=parents,
+    ))
+
+
+# transitively discover python dependencies and store them in 'packages'
+def find_packages(store_path: Path, site_packages_path: str, parents: List[str]) -> None:
+    site_packages: Path = (store_path / site_packages_path)
+    propagated_build_inputs: Path = (store_path / "nix-support/propagated-build-inputs")
+
+    # add the current package to the list
+    if site_packages.exists():
+        for dist_info in site_packages.glob("*.dist-info"):
+            dist: PathDistribution = PathDistribution(dist_info)
+            add_entry(get_name(dist), dist.version, store_path, parents)
+
+    # recursively add dependencies
+    if propagated_build_inputs.exists():
+        with open(propagated_build_inputs, "r") as f:
+            build_inputs: List[str] = f.read().strip().split(" ")
+            for build_input in build_inputs:
+                find_packages(Path(build_input), site_packages_path, parents + [build_input])
+
+
+find_packages(out_path, site_packages_path, [f"this derivation: {out_path}"])
+
+# print all duplicates
+for name, store_paths in packages.items():
+    if len(store_paths) > 1:
         do_abort = True
         print("Found duplicated packages in closure for dependency '{}': ".format(name))
-        for duplicate in duplicates:
-            print(f"\t{duplicate}")
+        for store_path, candidates in store_paths.items():
+            for candidate in candidates:
+                print(f"  {name} {candidate['version']} ({store_path})")
+                print(describe_parents(candidate['parents']))
 
+# fail if duplicates were found
 if do_abort:
     print("")
     print(
diff --git a/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix b/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix
index 1eea842871fc..0191517aa9ef 100644
--- a/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/cpython/default.nix
@@ -95,9 +95,6 @@ assert x11Support -> tcl != null
 
 assert bluezSupport -> bluez != null;
 
-assert lib.assertMsg (bluezSupport -> stdenv.isLinux)
-  "Bluez support is only available on Linux.";
-
 assert lib.assertMsg (enableFramework -> stdenv.isDarwin)
   "Framework builds are only supported on Darwin.";
 
diff --git a/nixpkgs/pkgs/development/interpreters/python/default.nix b/nixpkgs/pkgs/development/interpreters/python/default.nix
index 1322673c1bc6..95d2ca33558d 100644
--- a/nixpkgs/pkgs/development/interpreters/python/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/default.nix
@@ -20,10 +20,10 @@
       sourceVersion = {
         major = "3";
         minor = "11";
-        patch = "7";
+        patch = "8";
         suffix = "";
       };
-      hash = "sha256-GOGqfmb/OlhCPVntIoFaaVTlM0ISLEXfIMlod8Biubc=";
+      hash = "sha256-ngYAjIkBkkOVvB2jA+rFZ6cprgErqhgqs5Jp9lA4O7M=";
     };
   };
 
@@ -92,10 +92,10 @@ in {
     sourceVersion = {
       major = "3";
       minor = "12";
-      patch = "1";
+      patch = "2";
       suffix = "";
     };
-    hash = "sha256-jfuPQm/NImZX+eK9Xx6W5TJkllF2+hfTJljoc1ka6yE=";
+    hash = "sha256-vigRLayBPSBTVFwUvxOhZAGiGHfxpp626l2ExKDz2HA=";
     inherit (darwin) configd;
     inherit passthruFun;
   };
diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix b/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix
index bc7d011944e1..04b1f4a512c9 100644
--- a/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/python/hooks/default.nix
@@ -110,7 +110,7 @@ in {
     makePythonHook {
       name = "python-catch-conflicts-hook";
       substitutions = let
-        useLegacyHook = lib.versionOlder python.pythonVersion "3.10";
+        useLegacyHook = lib.versionOlder python.pythonVersion "3";
       in {
         inherit pythonInterpreter pythonSitePackages;
         catchConflicts = if useLegacyHook then
@@ -120,6 +120,10 @@ in {
       } // lib.optionalAttrs useLegacyHook {
         inherit setuptools;
       };
+      passthru.tests = import ./python-catch-conflicts-hook-tests.nix {
+        inherit pythonOnBuildForHost runCommand;
+        inherit (pkgs) coreutils gnugrep writeShellScript;
+      };
     } ./python-catch-conflicts-hook.sh) {};
 
   pythonImportsCheckHook = callPackage ({ makePythonHook }:
diff --git a/nixpkgs/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook-tests.nix b/nixpkgs/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook-tests.nix
new file mode 100644
index 000000000000..f3d9235799e0
--- /dev/null
+++ b/nixpkgs/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook-tests.nix
@@ -0,0 +1,137 @@
+{ pythonOnBuildForHost, runCommand, writeShellScript, coreutils, gnugrep }: let
+
+  pythonPkgs = pythonOnBuildForHost.pkgs;
+
+  ### UTILITIES
+
+  # customize a package so that its store paths differs
+  customize = pkg: pkg.overrideAttrs { some_modification = true; };
+
+  # generates minimal pyproject.toml
+  pyprojectToml = pname: builtins.toFile "pyproject.toml" ''
+    [project]
+    name = "${pname}"
+    version = "1.0.0"
+  '';
+
+  # generates source for a python project
+  projectSource = pname: runCommand "my-project-source" {} ''
+    mkdir -p $out/src
+    cp ${pyprojectToml pname} $out/pyproject.toml
+    touch $out/src/__init__.py
+  '';
+
+  # helper to reduce boilerplate
+  generatePythonPackage = args: pythonPkgs.buildPythonPackage (
+    {
+      version = "1.0.0";
+      src = runCommand "my-project-source" {} ''
+        mkdir -p $out/src
+        cp ${pyprojectToml args.pname} $out/pyproject.toml
+        touch $out/src/__init__.py
+      '';
+      pyproject = true;
+      catchConflicts = true;
+      buildInputs = [ pythonPkgs.setuptools ];
+    }
+    // args
+  );
+
+  # in order to test for a failing build, wrap it in a shell script
+  expectFailure = build: errorMsg: build.overrideDerivation (old: {
+    builder = writeShellScript "test-for-failure" ''
+      export PATH=${coreutils}/bin:${gnugrep}/bin:$PATH
+      ${old.builder} "$@" > ./log 2>&1
+      status=$?
+      cat ./log
+      if [ $status -eq 0 ] || ! grep -q "${errorMsg}" ./log; then
+        echo "The build should have failed with '${errorMsg}', but it didn't"
+        exit 1
+      else
+        echo "The build failed as expected with: ${errorMsg}"
+        mkdir -p $out
+      fi
+    '';
+  });
+in {
+
+  ### TEST CASES
+
+  # Test case which must not trigger any conflicts.
+  # This derivation has runtime dependencies on custom versions of multiple build tools.
+  # This scenario is relevant for lang2nix tools which do not override the nixpkgs fix-point.
+  # see https://github.com/NixOS/nixpkgs/issues/283695
+  ignores-build-time-deps =
+    generatePythonPackage {
+      pname = "ignores-build-time-deps";
+      buildInputs = [
+        pythonPkgs.build
+        pythonPkgs.packaging
+        pythonPkgs.setuptools
+        pythonPkgs.wheel
+      ];
+      propagatedBuildInputs = [
+        # Add customized versions of build tools as runtime deps
+        (customize pythonPkgs.packaging)
+        (customize pythonPkgs.setuptools)
+        (customize pythonPkgs.wheel)
+      ];
+    };
+
+  # Simplest test case that should trigger a conflict
+  catches-simple-conflict = let
+    # this build must fail due to conflicts
+    package = pythonPkgs.buildPythonPackage rec {
+      pname = "catches-simple-conflict";
+      version = "0.0.0";
+      src = projectSource pname;
+      pyproject = true;
+      catchConflicts = true;
+      buildInputs = [
+        pythonPkgs.setuptools
+      ];
+      # depend on two different versions of packaging
+      # (an actual runtime dependency conflict)
+      propagatedBuildInputs = [
+        pythonPkgs.packaging
+        (customize pythonPkgs.packaging)
+      ];
+    };
+  in
+    expectFailure package "Found duplicated packages in closure for dependency 'packaging'";
+
+
+  /*
+    More complex test case with a transitive conflict
+
+    Test sets up this dependency tree:
+
+      toplevel
+      ├── dep1
+      │   └── leaf
+      └── dep2
+          └── leaf (customized version -> conflicting)
+  */
+  catches-transitive-conflict = let
+    # package depending on both dependency1 and dependency2
+    toplevel = generatePythonPackage {
+      pname = "catches-transitive-conflict";
+      propagatedBuildInputs = [ dep1 dep2 ];
+    };
+    # dep1 package depending on leaf
+    dep1 = generatePythonPackage {
+      pname = "dependency1";
+      propagatedBuildInputs = [ leaf ];
+    };
+    # dep2 package depending on conflicting version of leaf
+    dep2 = generatePythonPackage {
+      pname = "dependency2";
+      propagatedBuildInputs = [ (customize leaf) ];
+    };
+    # some leaf package
+    leaf = generatePythonPackage {
+      pname = "leaf";
+    };
+  in
+    expectFailure toplevel "Found duplicated packages in closure for dependency 'leaf'";
+}
diff --git a/nixpkgs/pkgs/development/interpreters/ruby/default.nix b/nixpkgs/pkgs/development/interpreters/ruby/default.nix
index c14cb4648e35..9ec7a448b59f 100644
--- a/nixpkgs/pkgs/development/interpreters/ruby/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/ruby/default.nix
@@ -202,7 +202,9 @@ let
 
           # Allow to override compiler. This is important for cross compiling as
           # we need to set a compiler that is different from the build one.
-          sed -i 's/CONFIG\["CC"\] = "\(.*\)"/CONFIG["CC"] = if ENV["CC"].nil? || ENV["CC"].empty? then "\1" else ENV["CC"] end/'  "$rbConfig"
+          sed -i "$rbConfig" \
+            -e 's/CONFIG\["CC"\] = "\(.*\)"/CONFIG["CC"] = if ENV["CC"].nil? || ENV["CC"].empty? then "\1" else ENV["CC"] end/' \
+            -e 's/CONFIG\["CXX"\] = "\(.*\)"/CONFIG["CXX"] = if ENV["CXX"].nil? || ENV["CXX"].empty? then "\1" else ENV["CXX"] end/'
 
           # Remove unnecessary external intermediate files created by gems
           extMakefiles=$(find $out/${finalAttrs.passthru.gemPath} -name Makefile)
diff --git a/nixpkgs/pkgs/development/interpreters/ruby/rubygems/default.nix b/nixpkgs/pkgs/development/interpreters/ruby/rubygems/default.nix
index dd89e0cd41d7..2c756931169a 100644
--- a/nixpkgs/pkgs/development/interpreters/ruby/rubygems/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/ruby/rubygems/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   pname = "rubygems";
-  version = "3.5.5";
+  version = "3.5.6";
 
   src = fetchurl {
     url = "https://rubygems.org/rubygems/rubygems-${version}.tgz";
-    hash = "sha256-ErKsKMIEvs4oA8eS9v1ASfqlMOJOxeTVfCA99AIcTh0=";
+    hash = "sha256-8/zAMnzuC3677i7wFKQroFtAMtfhg0280xZd3nAMmcI=";
   };
 
   patches = [
diff --git a/nixpkgs/pkgs/development/interpreters/wasmtime/default.nix b/nixpkgs/pkgs/development/interpreters/wasmtime/default.nix
index 330f4bfba6b6..3247b7eb7dee 100644
--- a/nixpkgs/pkgs/development/interpreters/wasmtime/default.nix
+++ b/nixpkgs/pkgs/development/interpreters/wasmtime/default.nix
@@ -2,19 +2,19 @@
 
 rustPlatform.buildRustPackage rec {
   pname = "wasmtime";
-  version = "17.0.1";
+  version = "18.0.1";
 
   src = fetchFromGitHub {
     owner = "bytecodealliance";
     repo = pname;
     rev = "v${version}";
-    hash = "sha256-a1i6tYc6qMk0tNIo5BsC+ZaJyLaupmBhIIm6UVjD1U8=";
+    hash = "sha256-wCaDwaD/Xvm++PCrDmXo2Nqn9z07et8AhSI1e1527vc=";
     fetchSubmodules = true;
   };
 
   # Disable cargo-auditable until https://github.com/rust-secure-code/cargo-auditable/issues/124 is solved.
   auditable = false;
-  cargoHash = "sha256-PcN/cdezjjwC0Rk/QlNthNt5M3jRjxcCEd31GTVNHnU=";
+  cargoHash = "sha256-4fKJD3YmwFrHk38PUrpn4BDFkByylqRgPmuVHcVxdSI=";
   cargoBuildFlags = [ "--package" "wasmtime-cli" "--package" "wasmtime-c-api" ];
 
   outputs = [ "out" "dev" ];