at 24.11-pre 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 pname = "chruby"; 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 patches = lib.optionalString (rubies != null) [ 23 ./env.patch 24 ]; 25 26 postPatch = lib.optionalString (rubies != null) '' 27 substituteInPlace share/chruby/chruby.sh --replace "@rubiesEnv@" ${rubiesEnv} 28 ''; 29 30 installPhase = '' 31 mkdir $out 32 cp -r bin $out 33 cp -r share $out 34 ''; 35 36 meta = with lib; { 37 description = "Changes the current Ruby"; 38 homepage = "https://github.com/postmodern/chruby"; 39 license = licenses.mit; 40 maintainers = with maintainers; [ ]; 41 mainProgram = "chruby-exec"; 42 platforms = platforms.unix; 43 }; 44}