diff --git a/pkgs/development/compilers/llvm/15/default.nix b/pkgs/development/compilers/llvm/15/default.nix index 0082ae8505e7..96c4c6e8aa4c 100644 --- a/pkgs/development/compilers/llvm/15/default.nix +++ b/pkgs/development/compilers/llvm/15/default.nix @@ -54,24 +54,10 @@ in let monorepoSrc' = monorepoSrc; in let - monorepoSrc = if monorepoSrc' != null then - monorepoSrc' - else let - sha256 = releaseInfo.original.sha256; - rev = if gitRelease != null then - gitRelease.rev - else - "llvmorg-${releaseInfo.version}"; - in fetchFromGitHub { - owner = "llvm"; - repo = "llvm-project"; - inherit rev sha256; - }; - # Import releaseInfo separately to avoid infinite recursion inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo; inherit (releaseInfo) release_version version; - inherit (import ../common/common-let.nix { inherit lib release_version gitRelease officialRelease; }) llvm_meta; + inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc; tools = lib.makeExtensible (tools: let callPackage = newScope (tools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc buildLlvmTools; }); diff --git a/pkgs/development/compilers/llvm/16/default.nix b/pkgs/development/compilers/llvm/16/default.nix index 5213ebc37b47..d75e1a121a99 100644 --- a/pkgs/development/compilers/llvm/16/default.nix +++ b/pkgs/development/compilers/llvm/16/default.nix @@ -54,24 +54,10 @@ in let monorepoSrc' = monorepoSrc; in let - monorepoSrc = if monorepoSrc' != null then - monorepoSrc' - else let - sha256 = releaseInfo.original.sha256; - rev = if gitRelease != null then - gitRelease.rev - else - "llvmorg-${releaseInfo.version}"; - in fetchFromGitHub { - owner = "llvm"; - repo = "llvm-project"; - inherit rev sha256; - }; - # Import releaseInfo separately to avoid infinite recursion inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo; inherit (releaseInfo) release_version version; - inherit (import ../common/common-let.nix { inherit lib release_version gitRelease officialRelease; }) llvm_meta; + inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc; tools = lib.makeExtensible (tools: let callPackage = newScope (tools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc buildLlvmTools; }); diff --git a/pkgs/development/compilers/llvm/common/common-let.nix b/pkgs/development/compilers/llvm/common/common-let.nix index d56063f1bc43..31360f5b98b9 100644 --- a/pkgs/development/compilers/llvm/common/common-let.nix +++ b/pkgs/development/compilers/llvm/common/common-let.nix @@ -1,10 +1,12 @@ { lib +, fetchFromGitHub ? null , release_version ? null , gitRelease ? null , officialRelease ? null +, monorepoSrc' ? null }: -{ +rec { llvm_meta = { license = lib.licenses.ncsa; maintainers = lib.teams.llvm.members; @@ -37,4 +39,22 @@ release_version; }; + monorepoSrc = + if monorepoSrc' != null then + monorepoSrc' + else + let + sha256 = releaseInfo.original.sha256; + rev = + if gitRelease != null then + gitRelease.rev + else + "llvmorg-${releaseInfo.version}"; + in + fetchFromGitHub { + owner = "llvm"; + repo = "llvm-project"; + inherit rev sha256; + }; + } diff --git a/pkgs/development/compilers/llvm/git/default.nix b/pkgs/development/compilers/llvm/git/default.nix index dc5ea642995c..2506d177a174 100644 --- a/pkgs/development/compilers/llvm/git/default.nix +++ b/pkgs/development/compilers/llvm/git/default.nix @@ -53,25 +53,10 @@ in let monorepoSrc' = monorepoSrc; in let - monorepoSrc = if monorepoSrc' != null then - monorepoSrc' - else let - sha256 = releaseInfo.original.sha256; - rev = if gitRelease != null then - gitRelease.rev - else - "llvmorg-${releaseInfo.version}"; - in fetchFromGitHub { - owner = "llvm"; - repo = "llvm-project"; - inherit rev sha256; - }; - - # Import releaseInfo separately to avoid infinite recursion inherit (import ../common/common-let.nix { inherit lib gitRelease officialRelease; }) releaseInfo; inherit (releaseInfo) release_version version; - inherit (import ../common/common-let.nix { inherit lib release_version gitRelease officialRelease; }) llvm_meta; + inherit (import ../common/common-let.nix { inherit lib fetchFromGitHub release_version gitRelease officialRelease monorepoSrc'; }) llvm_meta monorepoSrc; tools = lib.makeExtensible (tools: let callPackage = newScope (tools // { inherit stdenv cmake ninja libxml2 python3 release_version version monorepoSrc buildLlvmTools; });