From 9dc98729220e051863e3351965c9f81a78cf86a2 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Wed, 16 Aug 2023 22:56:22 -0700 Subject: [PATCH] gcc: default.nix: parameterize by version --- pkgs/development/compilers/gcc/default.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/gcc/default.nix b/pkgs/development/compilers/gcc/default.nix index 01cedef86b8b..4be1d1a95f8d 100644 --- a/pkgs/development/compilers/gcc/default.nix +++ b/pkgs/development/compilers/gcc/default.nix @@ -31,8 +31,12 @@ , disableGdbPlugin ? !enablePlugin , nukeReferences , callPackage +, version }: +# only gcc13 is currently supported +assert lib.versions.major version == "13"; + # Make sure we get GNU sed. assert stdenv.buildPlatform.isDarwin -> gnused != null; @@ -54,8 +58,8 @@ assert reproducibleBuild -> profiledCompiler == false; with lib; with builtins; -let majorVersion = "13"; - version = "${majorVersion}.1.0"; +let majorVersion = lib.versions.major version; + inherit version; disableBootstrap = !stdenv.hostPlatform.isDarwin && !profiledCompiler; inherit (stdenv) buildPlatform hostPlatform targetPlatform; @@ -141,7 +145,7 @@ let majorVersion = "13"; stageNameAddon crossNameAddon ; - # inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc13.cc.override)" | jq '.[]' --raw-output' + # inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc${majorVersion}.cc.override)" | jq '.[]' --raw-output' inherit binutils buildPackages