nimPackages.buildNimPackage: move to top-level

This commit is contained in:
Emery Hemingway 2023-11-20 10:12:30 +02:00
parent 89153ceb44
commit 39d4eace91
3 changed files with 17 additions and 8 deletions

View file

@ -1,4 +1,4 @@
{ lib, stdenv, nim, nim_builder }:
{ lib, stdenv, nim1, nim2, nim_builder, defaultNimVersion ? 2 }:
pkgArgs:
let
@ -27,13 +27,19 @@ let
nim_builder --phase:install
runHook postInstall
'';
meta = { inherit (nim.meta) maintainers platforms; };
meta = { inherit (nim2.meta) maintainers platforms; };
};
inputsOverride =
{ depsBuildBuild ? [ ], nativeBuildInputs ? [ ], ... }: {
inputsOverride = { depsBuildBuild ? [ ], nativeBuildInputs ? [ ]
, requiredNimVersion ? defaultNimVersion, ... }:
(if requiredNimVersion == 1 then {
nativeBuildInputs = [ nim1 ] ++ nativeBuildInputs;
} else if requiredNimVersion == 2 then {
nativeBuildInputs = [ nim2 ] ++ nativeBuildInputs;
} else
throw "requiredNimVersion ${toString requiredNimVersion} is not valid")
// {
depsBuildBuild = [ nim_builder ] ++ depsBuildBuild;
nativeBuildInputs = [ nim ] ++ nativeBuildInputs;
};
composition = finalAttrs:

View file

@ -16810,6 +16810,7 @@ with pkgs;
nim = nim1;
nimPackages = recurseIntoAttrs nim1.pkgs;
nim2Packages = recurseIntoAttrs nim2.pkgs;
buildNimPackage = callPackage ../development/compilers/nim/build-nim-package.nix { };
nrpl = callPackage ../development/tools/nrpl { };

View file

@ -1,11 +1,13 @@
{ lib, pkgs, stdenv, newScope, nim, fetchFromGitHub }:
{ lib, pkgs, stdenv, newScope, nim, buildNimPackage }:
lib.makeScope newScope (self:
let callPackage = self.callPackage;
in {
inherit nim;
buildNimPackage =
callPackage ../development/nim-packages/build-nim-package { };
buildNimPackage = buildNimPackage.override {
defaultNimVersion =
if lib.versionAtLeast nim.version "2.0.0" then 2 else 1;
};
asciigraph = callPackage ../development/nim-packages/asciigraph { };