Commit 7901ce6a authored by Emery Hemingway's avatar Emery Hemingway
Browse files

Remove Nimble from Nim wrapper

parent f73c2114
Loading
Loading
Loading
Loading
+3 −50
Original line number Diff line number Diff line
@@ -175,45 +175,8 @@ in {
    ];
  });

  nimble-unwrapped = stdenv.mkDerivation rec {
    pname = "nimble-unwrapped";
    version = "0.14.2";
    strictDeps = true;

    src = fetchFromGitHub {
      owner = "nim-lang";
      repo = "nimble";
      rev = "v${version}";
      hash = "sha256-8b5yKvEl7c7wA/8cpdaN2CSvawQJzuRce6mULj3z/mI=";
    };

    depsBuildBuild = [ nim-unwrapped ];
    buildInputs = [ openssl ] ++ lib.optional stdenv.isDarwin Security;

    nimFlags = [ "--cpu:${nimHost.cpu}" "--os:${nimHost.os}" "-d:release" ];

    buildPhase = ''
      runHook preBuild
      HOME=$NIX_BUILD_TOP nim c $nimFlags src/nimble
      runHook postBuild
    '';

    installPhase = ''
      runHook preBuild
      install -Dt $out/bin src/nimble
      runHook postBuild
    '';

    meta = with lib; {
      description = "Package manager for the Nim programming language";
      homepage = "https://github.com/nim-lang/nimble";
      license = licenses.bsd3;
      maintainers = with maintainers; [ ehmry ];
      mainProgram = "nimble";
    };
  };
} // (let
  wrapNim = { nim', nimble', patches }:
  wrapNim = { nim', patches }:
    let
      targetPlatformConfig = stdenv.targetPlatform.config;
      self = stdenv.mkDerivation (finalAttrs: {
@@ -328,20 +291,11 @@ in {
            $wrapperArgs
          ln -s $out/bin/${targetPlatformConfig}-testament $out/bin/testament

        '' + lib.strings.optionalString (nimble' != null) ''
          makeWrapper \
            ${nimble'}/bin/nimble $out/bin/${targetPlatformConfig}-nimble \
            --suffix PATH : $out/bin
          ln -s $out/bin/${targetPlatformConfig}-nimble $out/bin/nimble

        '' + ''
          runHook postInstall
        '';

        passthru = {
          nim = nim';
          nimble = nimble';
        };
        passthru = { nim = nim'; };

        meta = nim'.meta // {
          description = nim'.meta.description
@@ -356,13 +310,12 @@ in {

  nim = wrapNim {
    nim' = buildPackages.nim-unwrapped;
    nimble' = buildPackages.nimble-unwrapped;
    patches = [ ./nim.cfg.patch ];
  };

  nim2 = wrapNim {
    nim' = buildPackages.nim-unwrapped-2;
    nimble' = null;
    patches = [ ./nim2.cfg.patch ];
  };

})