Files
nixpkgs/pkgs/development/tools/misc/chruby/default.nix
T
Ihar Hrachyshka 567e8dfd8e treewide: clean up 'meta = with' pattern
This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with
lib;`, and
- regular nixfmt.

Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
2025-12-10 18:09:49 +01:00

51 lines
1.0 KiB
Nix

{
stdenv,
lib,
fetchFromGitHub,
runCommand,
rubies ? null,
}:
let
rubiesEnv = runCommand "chruby-env" { preferLocalBuild = true; } ''
mkdir $out
${lib.concatStrings (lib.mapAttrsToList (name: path: "ln -s ${path} $out/${name}\n") rubies)}
'';
in
stdenv.mkDerivation rec {
pname = "chruby";
version = "0.3.9";
src = fetchFromGitHub {
owner = "postmodern";
repo = "chruby";
rev = "v${version}";
sha256 = "1894g6fymr8kra9vwhbmnrcr58l022mcd7g9ans4zd3izla2j3gx";
};
patches = lib.optionalString (rubies != null) [
./env.patch
];
postPatch = lib.optionalString (rubies != null) ''
substituteInPlace share/chruby/chruby.sh --replace "@rubiesEnv@" ${rubiesEnv}
'';
installPhase = ''
mkdir $out
cp -r bin $out
cp -r share $out
'';
meta = {
description = "Changes the current Ruby";
homepage = "https://github.com/postmodern/chruby";
license = lib.licenses.mit;
maintainers = [ ];
mainProgram = "chruby-exec";
platforms = lib.platforms.unix;
};
}