Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 24.05-beta 155 lines 4.7 kB view raw
1# similar to interpreters/python/default.nix 2{ stdenv, config, lib, callPackage, fetchFromGitHub, fetchurl, fetchpatch, makeBinaryWrapper }: 3 4 5let 6 7 # Common passthru for all lua interpreters. 8 # copied from python 9 passthruFun = 10 { executable 11 , luaversion 12 , packageOverrides 13 , luaOnBuildForBuild 14 , luaOnBuildForHost 15 , luaOnBuildForTarget 16 , luaOnHostForHost 17 , luaOnTargetForTarget 18 , luaAttr ? null 19 , self # is luaOnHostForTarget 20 }: let 21 luaPackages = callPackage 22 # Function that when called 23 # - imports lua-packages.nix 24 # - adds spliced package sets to the package set 25 # - applies overrides from `packageOverrides` 26 ({ lua, overrides, callPackage, makeScopeWithSplicing' }: let 27 luaPackagesFun = callPackage ../../../top-level/lua-packages.nix { 28 lua = self; 29 }; 30 generatedPackages = if (builtins.pathExists ../../lua-modules/generated-packages.nix) then 31 (final: prev: callPackage ../../lua-modules/generated-packages.nix { inherit (final) callPackage; } final prev) 32 else (final: prev: {}); 33 overriddenPackages = callPackage ../../lua-modules/overrides.nix { }; 34 35 otherSplices = { 36 selfBuildBuild = luaOnBuildForBuild.pkgs; 37 selfBuildHost = luaOnBuildForHost.pkgs; 38 selfBuildTarget = luaOnBuildForTarget.pkgs; 39 selfHostHost = luaOnHostForHost.pkgs; 40 selfTargetTarget = luaOnTargetForTarget.pkgs or {}; 41 }; 42 43 aliases = final: prev: 44 lib.optionalAttrs config.allowAliases 45 (import ../../lua-modules/aliases.nix lib final prev); 46 47 extensions = lib.composeManyExtensions [ 48 aliases 49 generatedPackages 50 overriddenPackages 51 overrides 52 ]; 53 in makeScopeWithSplicing' { 54 inherit otherSplices; 55 f = lib.extends extensions luaPackagesFun; 56 }) 57 { 58 overrides = packageOverrides; 59 lua = self; 60 }; 61 in rec { 62 buildEnv = callPackage ./wrapper.nix { 63 lua = self; 64 makeWrapper = makeBinaryWrapper; 65 inherit (luaPackages) requiredLuaModules; 66 }; 67 withPackages = import ./with-packages.nix { inherit buildEnv luaPackages;}; 68 pkgs = let lp = luaPackages; 69 in lp // { luaPackages = lp.luaPackages // { __attrsFailEvaluation = true; }; }; 70 interpreter = "${self}/bin/${executable}"; 71 inherit executable luaversion; 72 luaOnBuild = luaOnBuildForHost.override { inherit packageOverrides; self = luaOnBuild; }; 73 74 tests = callPackage ./tests { lua = self; inherit (luaPackages) wrapLua; }; 75 76 inherit luaAttr; 77 }; 78 79in 80 81rec { 82 lua5_4 = callPackage ./interpreter.nix { 83 self = lua5_4; 84 version = "5.4.6"; 85 hash = "sha256-fV6huctqoLWco93hxq3LV++DobqOVDLA7NBr9DmzrYg="; 86 makeWrapper = makeBinaryWrapper; 87 inherit passthruFun; 88 89 patches = lib.optional stdenv.isDarwin ./5.4.darwin.patch; 90 }; 91 92 lua5_4_compat = lua5_4.override({ 93 self = lua5_4_compat; 94 compat = true; 95 }); 96 97 lua5_3 = callPackage ./interpreter.nix { 98 self = lua5_3; 99 version = "5.3.6"; 100 hash = "0q3d8qhd7p0b7a4mh9g7fxqksqfs6mr1nav74vq26qvkp2dxcpzw"; 101 makeWrapper = makeBinaryWrapper; 102 inherit passthruFun; 103 104 patches = 105 lib.optionals stdenv.isDarwin [ ./5.2.darwin.patch ]; 106 }; 107 108 lua5_3_compat = lua5_3.override({ 109 self = lua5_3_compat; 110 compat = true; 111 }); 112 113 114 lua5_2 = callPackage ./interpreter.nix { 115 self = lua5_2; 116 version = "5.2.4"; 117 hash = "0jwznq0l8qg9wh5grwg07b5cy3lzngvl5m2nl1ikp6vqssmf9qmr"; 118 makeWrapper = makeBinaryWrapper; 119 inherit passthruFun; 120 patches = [ 121 ./CVE-2022-28805.patch 122 ] ++ lib.optional stdenv.isDarwin ./5.2.darwin.patch; 123 }; 124 125 lua5_2_compat = lua5_2.override({ 126 self = lua5_2_compat; 127 compat = true; 128 }); 129 130 131 lua5_1 = callPackage ./interpreter.nix { 132 self = lua5_1; 133 version = "5.1.5"; 134 hash = "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333"; 135 makeWrapper = makeBinaryWrapper; 136 inherit passthruFun; 137 patches = (lib.optional stdenv.isDarwin ./5.1.darwin.patch) 138 ++ [ ./CVE-2014-5461.patch ]; 139 }; 140 141 luajit_2_0 = import ../luajit/2.0.nix { 142 self = luajit_2_0; 143 inherit callPackage fetchFromGitHub lib passthruFun; 144 }; 145 146 luajit_2_1 = import ../luajit/2.1.nix { 147 self = luajit_2_1; 148 inherit callPackage fetchFromGitHub passthruFun; 149 }; 150 151 luajit_openresty = import ../luajit/openresty.nix { 152 self = luajit_openresty; 153 inherit callPackage fetchFromGitHub passthruFun; 154 }; 155}