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