bobvanderlinden / nixpkgs-ruby

A Nix repository with all Ruby versions being kept up-to-date automatically

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

attribute 'ruby' missing in a new project

Quintasan opened this issue · comments

I have a Ruby 3.1.2 (ruby-3.1.2 in .ruby-version) project. I tried using nix flake init -t github:bobvanderlinden/nixpkgs-ruby# but I'm getting error: attribute 'ruby' missing when cding into the project directory

direnv: loading ~/sauce/asi/asi.wroclaw.pl/.envrc
direnv: using flake
warning: Git tree '/home/quintasan/sauce/asi/asi.wroclaw.pl' is dirty
error: attribute 'ruby' missing

       at /nix/store/r9kwh98ww53k46wrd8chqvxfs3hv9x1c-source/flake.nix:14:45:

           13|         getRubyVersionEntry = rubyVersion:
           14|           builtins.foldl' (parent: segment: parent.${segment}) self.lib.versions
             |                                             ^
           15|             (builtins.splitVersion rubyVersion);
(use '--show-trace' to show detailed location information)
warning: Git tree '/home/quintasan/sauce/asi/asi.wroclaw.pl' is dirty
direnv: nix-direnv: renewed cache
direnv: export ~XDG_DATA_DIRS

What am I doing wrong? I would include my flake.nix but it's literally https://github.com/bobvanderlinden/nixpkgs-ruby/blob/master/template/flake.nix with no changes 🤔

I was able to "fix" it by doing

ruby = nixpkgs-ruby.lib.mkRuby { inherit pkgs; rubyVersion = "3.1.2"; };

which is more of a workaround 🤔

Hmm, I think your .ruby-version contained ruby-3.1.2 and not 3.1.2? Can you check what is in your .ruby-version?
I know only of .ruby-version containing solely a version and no other prefixes/suffixes.

#37 fixes the template to allow ruby-X.X.X as well as X.X.X in .ruby-version.

#45 will introduce a more convenient library function to directly fetch the right Ruby package from a .ruby-version file.