Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 90 lines 2.8 kB view raw
1{ callPackage }: 2 3let 4 # Common passthru for all perl interpreters. 5 # copied from lua 6 passthruFun = 7 { 8 overrides, 9 perlOnBuildForBuild, 10 perlOnBuildForHost, 11 perlOnBuildForTarget, 12 perlOnHostForHost, 13 perlOnTargetForTarget, 14 perlAttr ? null, 15 self, # is perlOnHostForTarget 16 }: 17 let 18 perlPackages = 19 callPackage 20 # Function that when called 21 # - imports perl-packages.nix 22 # - adds spliced package sets to the package set 23 ( 24 { 25 stdenv, 26 pkgs, 27 perl, 28 callPackage, 29 makeScopeWithSplicing', 30 }: 31 let 32 perlPackagesFun = callPackage ../../../top-level/perl-packages.nix { 33 # allow 'perlPackages.override { pkgs = pkgs // { imagemagick = imagemagickBig; }; }' like in python3Packages 34 # most perl packages aren't called with callPackage so it's not possible to override their arguments individually 35 # the conditional is because the // above won't be applied to __splicedPackages and hopefully no one is doing that when cross-compiling 36 pkgs = if stdenv.buildPlatform != stdenv.hostPlatform then pkgs.__splicedPackages else pkgs; 37 inherit stdenv; 38 perl = self; 39 }; 40 41 otherSplices = { 42 selfBuildBuild = perlOnBuildForBuild.pkgs; 43 selfBuildHost = perlOnBuildForHost.pkgs; 44 selfBuildTarget = perlOnBuildForTarget.pkgs; 45 selfHostHost = perlOnHostForHost.pkgs; 46 selfTargetTarget = perlOnTargetForTarget.pkgs or { }; 47 }; 48 in 49 makeScopeWithSplicing' { 50 inherit otherSplices; 51 f = perlPackagesFun; 52 } 53 ) 54 { 55 perl = self; 56 }; 57 in 58 rec { 59 buildEnv = callPackage ./wrapper.nix { 60 perl = self; 61 inherit (pkgs) requiredPerlModules; 62 }; 63 withPackages = f: buildEnv.override { extraLibs = f pkgs; }; 64 pkgs = perlPackages // (overrides pkgs); 65 interpreter = "${self}/bin/perl"; 66 libPrefix = "lib/perl5/site_perl"; 67 perlOnBuild = perlOnBuildForHost.override { 68 inherit overrides; 69 self = perlOnBuild; 70 }; 71 }; 72 73in 74rec { 75 # Maint version 76 perl538 = callPackage ./interpreter.nix { 77 self = perl538; 78 version = "5.38.2"; 79 sha256 = "sha256-oKMVNEUet7g8fWWUpJdUOlTUiLyQygD140diV39AZV4="; 80 inherit passthruFun; 81 }; 82 83 # Maint version 84 perl540 = callPackage ./interpreter.nix { 85 self = perl540; 86 version = "5.40.0"; 87 sha256 = "sha256-x0A0jzVzljJ6l5XT6DI7r9D+ilx4NfwcuroMyN/nFh8="; 88 inherit passthruFun; 89 }; 90}