at v192 1.1 kB view raw
1{ stdenv, lib, fetchFromGitHub, runCommand, rubies ? null }: 2 3let 4 rubiesEnv = runCommand "chruby-env" { preferLocalBuild = true; } '' 5 mkdir $out 6 ${lib.concatStrings 7 (lib.mapAttrsToList (name: path: "ln -s ${path} $out/${name}\n") rubies)} 8 ''; 9 10in stdenv.mkDerivation rec { 11 name = "chruby-${version}"; 12 13 version = "0.3.9"; 14 15 src = fetchFromGitHub { 16 owner = "postmodern"; 17 repo = "chruby"; 18 rev = "v${version}"; 19 sha256 = "1894g6fymr8kra9vwhbmnrcr58l022mcd7g9ans4zd3izla2j3gx"; 20 }; 21 22 phases = [ "unpackPhase" "patchPhase" "installPhase" "fixupPhase" ]; 23 24 patches = lib.optionalString (rubies != null) [ 25 ./env.patch 26 ]; 27 28 postPatch = lib.optionalString (rubies != null) '' 29 substituteInPlace share/chruby/chruby.sh --replace "@rubiesEnv@" ${rubiesEnv} 30 ''; 31 32 installPhase = '' 33 mkdir $out 34 cp -r bin $out 35 cp -r share $out 36 ''; 37 38 meta = with lib; { 39 description = "Changes the current Ruby"; 40 homepage = https://github.com/postmodern/chruby; 41 license = licenses.mit; 42 platforms = platforms.unix; 43 maintainers = with maintainers; [ cstrahan ]; 44 }; 45}