Setup github pages + jekyll with a nix shell

I have the following flake:

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-parts.url = "github:hercules-ci/flake-parts";

  outputs = inputs@{ flake-parts, ... }:
    flake-parts.lib.mkFlake { inherit inputs; }
        systems = [

        perSystem = { self', lib, system, pkgs, config, ... }: {
          devShells.default = pkgs.mkShell {
            packages = with pkgs; [

If I execute

jekyll new blog

I’m getting

Running bundle install in /home/tornax/projects/TornaxO7/blog...
  Bundler: Skipping "bundle install" as it fails due to the Nix wrapper.
  Bundler: Please enter the new directory and run the following commands to serve the page:
  Bundler: nix-shell -p bundler --run "bundle install --gemfile=Gemfile --path vendor/cache"
  Bundler: nix-shell -p bundler --run "bundle exec jekyll serve"
New jekyll site installed in /home/tornax/projects/TornaxO7/blog.

now after running

cd blog
bundle install --gemfile=Gemfile --path vendor/cache
bundle exec jekyll serve

I’m getting

/home/tornax/projects/TornaxO7/blog/vendor/cache/ruby/3.1.0/gems/sass-embedded-1.72.0-x86_64-linux-gnu/lib/sass/compiler/connection.rb:54: warning: Could not start dynamically linked executable: /home/tornax/projects/TornaxO7/blog/vendor/cache/ruby/3.1.0/gems/sass-embedded-1.72.0-x86_64-linux-gnu/ext/sass/dart-sass/src/dart
/home/tornax/projects/TornaxO7/blog/vendor/cache/ruby/3.1.0/gems/sass-embedded-1.72.0-x86_64-linux-gnu/lib/sass/compiler/connection.rb:54: warning: NixOS cannot run dynamically linked executables intended for generic
/home/tornax/projects/TornaxO7/blog/vendor/cache/ruby/3.1.0/gems/sass-embedded-1.72.0-x86_64-linux-gnu/lib/sass/compiler/connection.rb:54: warning: linux environments out of the box. For more information, see:
/home/tornax/projects/TornaxO7/blog/vendor/cache/ruby/3.1.0/gems/sass-embedded-1.72.0-x86_64-linux-gnu/lib/sass/compiler/connection.rb:54: warning:
  Conversion error: Jekyll::Converters::Scss encountered an error while converting 'assets/main.scss':
                    Broken pipe
      Jekyll 4.3.3   Please append `--trace` to the `serve` command
                     for any additional information or backtrace.

does anyone how to fix this?

It’s failing because a downloaded dependency is running native binaries. Native binaries usually don’t work without some work. One option may be to run nix-ld. My preferred option is to capture the complete Bundler dependencies in the flake using bundix. It requires more upfront work, but you’ll get complete reproducibility in exchange.

Here’s an example of the latter approach: