diff --git a/pkgs/applications/misc/jekyll/default.nix b/pkgs/applications/misc/jekyll/default.nix index 34cf0e21db7..9ae9ab254e8 100644 --- a/pkgs/applications/misc/jekyll/default.nix +++ b/pkgs/applications/misc/jekyll/default.nix @@ -1,8 +1,27 @@ { lib, bundlerApp, ruby +, writeShellScriptBin, makeWrapper , withOptionalDependencies ? false }: -bundlerApp rec { +let + rubyWrapper = writeShellScriptBin "ruby" '' + if [[ "$#" -eq 2 ]]; then + if [[ "''${1##*/}" == "bundle" && "$2" == "install" ]]; then + # See https://github.com/NixOS/nixpkgs/issues/58126 for more details. + echo 'Skipping "bundle install" as it fails due to the Nix wrapper.' + echo 'Please enter the new directory and run the following commands to serve the page:' + echo 'nix-shell -p bundler --run "bundle install --gemfile=Gemfile --path vendor/cache"' + echo 'nix-shell -p bundler --run "bundle exec jekyll serve"' + exit 0 + # The following nearly works: + unset BUNDLE_FROZEN + exec ${ruby}/bin/ruby "$@" --gemfile=Gemfile --path=vendor/cache + fi + fi + # Else: Don't modify the arguments: + exec ${ruby}/bin/ruby "$@" + ''; +in bundlerApp rec { pname = "jekyll"; exes = [ "jekyll" ]; @@ -11,6 +30,12 @@ bundlerApp rec { then ./full else ./basic; + buildInputs = [ makeWrapper ]; + + postBuild = '' + wrapProgram $out/bin/jekyll --prefix PATH : ${rubyWrapper}/bin + ''; + meta = with lib; { description = "A blog-aware, static site generator, written in Ruby"; longDescription = ''