Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 60 lines 1.6 kB view raw
1{ 2 lib, 3 fetchFromGitHub, 4 buildRubyGem, 5 bundlerEnv, 6 ruby, 7}: 8 9let 10 gemName = "github-linguist"; 11 version = "9.1.0"; 12 src = fetchFromGitHub { 13 owner = "github-linguist"; 14 repo = "linguist"; 15 tag = "v${version}"; 16 hash = "sha256-nPIUo6yQY6WvKuXvT1oOx6LZq49QLa9YIJmOrRYgAdg="; 17 }; 18 19 deps = bundlerEnv { 20 name = "github-linguist-dep"; 21 gemfile = "${src}/Gemfile"; 22 lockfile = ./Gemfile.lock; 23 gemset = ./gemset.nix; 24 }; 25 26in 27buildRubyGem rec { 28 name = "${gemName}-${version}"; 29 inherit gemName version src; 30 31 doInstallCheck = true; 32 dontBuild = false; 33 34 postInstall = '' 35 export GEM_PATH="${deps}/lib/ruby/gems/${ruby.version.libDir}" 36 bundle exec rake samples 37 install --mode=0644 -Dm 0755 lib/linguist/samples.json $out/lib/ruby/gems/${ruby.version.libDir}/gems/${name}/lib/linguist 38 39 wrapProgram "$out/bin/github-linguist" \ 40 --set GEM_PATH "${deps}/lib/ruby/gems/${ruby.version.libDir}" 41 42 wrapProgram "$out/bin/git-linguist" \ 43 --set GEM_PATH "${deps}/lib/ruby/gems/${ruby.version.libDir}" 44 ''; 45 46 passthru = { 47 inherit ruby deps; 48 }; 49 50 meta = { 51 description = "Language savant Ruby library"; 52 longDescription = '' 53 A Ruby library that is used on GitHub.com to detect blob languages, ignore binary or vendored files, suppress generated files in diffs, and generate language breakdown graphs. 54 ''; 55 homepage = "https://github.com/github-linguist/linguist"; 56 license = lib.licenses.mit; 57 maintainers = with lib.maintainers; [ Cryolitia ]; 58 platforms = with lib.platforms; linux ++ darwin; 59 }; 60}