Skip to content

How to add new buildInputs #58

@fzakaria

Description

@fzakaria

I'm trying to work on a rails 8 project with tailwindcss.
I'm having trouble adding tailwindcss-ruby to my gemset.nix

gemset.nix seems to include every possible platform and tailwindcss-ruby is offered on linux-gnu and linux-musl.

I am failing to run autoPatchElf for the linux-musl variant and it's not clear how to fix this (or if i even should?)
relevant: https://github.com/inscapist/ruby-nix/blob/main/modules/gems/expand.nix#L46

# frozen_string_literal: true
source "https://rubygems.org"
gem "tailwindcss", "~> 1.0"
gem "tailwindcss-ruby", "~> 4.0"
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
    systems.url = "github:nix-systems/default";
    bundix = {
      url = "github:inscapist/bundix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    ruby-nix = {
      url = "github:inscapist/ruby-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {
    self,
    systems,
    nixpkgs,
    bundix,
    ruby-nix,
    ...
  }: let
    eachSystem = f:
      nixpkgs.lib.genAttrs (import systems) (system:
        f {
          pkgs = nixpkgs.legacyPackages.${system};
          inherit system;
        });
  in {
    formatter = eachSystem ({pkgs, ...}: pkgs.alejandra);

    devShells = eachSystem ({
      pkgs,
      system,
    }: {
      default = let
        rubyNix = ruby-nix.lib pkgs;
        gemset =
          if builtins.pathExists ./gemset.nix
          then import ./gemset.nix
          else {};
        ruby = pkgs.ruby_3_4;
        bundixcli = bundix.packages.${system}.default;
        inherit
          (rubyNix {
            name = "test";
            inherit gemset ruby;
            gemConfig = pkgs.defaultGemConfig // {
              # Not sure how to get it to build here?
              tailwindcss-ruby = attrs: {
                nativeBuildInputs = [pkgs.musl.dev];
              };
            };
          })
          env;
      in
        pkgs.mkShell {
          buildInputs = [
            pkgs.ruby_3_4
            env
            bundixcli
          ];
        };
    });
  };
}

Very grateful that you seemed to have carried the bundix torch forward but I'd love to better understand how to work with platform specific gems with this flake.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions