summary refs log tree commit diff
path: root/pkgs/development/ruby-modules/testing/stubs.nix
blob: 7e6d1102f666916b9225777e836b419aaa7015ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ stdenv, lib, ruby, callPackage, ... }:
let
  mkDerivation = {name, ...}@argSet:
  derivation {
    inherit name;
    text = (builtins.toJSON (lib.filterAttrs ( n: v: builtins.any (x: x == n) ["name" "system"]) argSet));
    builder = stdenv.shell;
    args = [ "-c" "echo  $(<$textPath) > $out"];
    system = stdenv.system;
    passAsFile = ["text"];
  };
  fetchurl = {url?"", urls ? [],...}: "fetchurl:${if urls == [] then url else builtins.head urls}";

  stdenv' = stdenv // {
    inherit mkDerivation;
    stubbed = true;
  };
  ruby' = ruby // {
    stdenv = stdenv';
    stubbed = true;
  };
in
  {
    ruby = ruby';
    buildRubyGem = callPackage ../gem {
      inherit fetchurl;
      ruby = ruby';
    };
    stdenv = stdenv';
  }