Closed pcasaretto closed 9 months ago
Changing back to Ruby 3.2 as per the example makes bundle available. I guess the old Ruby versions don't include bundler? Can I specify I need it in my flake file?
Sorry, I missed this entirely. This is something I experienced myself after using nixpkgs-ruby
. I will update the example to reflect the shortage.
Thanks for filing this.
{
description = "A simple ruby app demo";
nixConfig = {
extra-substituters = "https://nixpkgs-ruby.cachix.org";
extra-trusted-public-keys =
"nixpkgs-ruby.cachix.org-1:vrcdi50fTolOxWCZZkw0jakOnUI1T19oYJ+PRYdK4SM=";
};
inputs = {
nixpkgs.url = "nixpkgs";
ruby-nix.url = "github:inscapist/ruby-nix";
# a fork that supports platform dependant gem
bundix = {
url = "github:inscapist/bundix/main";
inputs.nixpkgs.follows = "nixpkgs";
};
fu.url = "github:numtide/flake-utils";
bob-ruby.url = "github:bobvanderlinden/nixpkgs-ruby";
bob-ruby.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, fu, ruby-nix, bundix, bob-ruby }:
with fu.lib;
eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ bob-ruby.overlays.default];
config.permittedInsecurePackages = [
"openssl-1.1.1w"
];
};
rubyNix = ruby-nix.lib pkgs;
# TODO generate gemset.nix with bundix
gemset =
if builtins.pathExists ./gemset.nix then import ./gemset.nix else { };
# If you want to override gem build config, see
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/ruby-modules/gem-config/default.nix
gemConfig = { };
# See available versions here: https://github.com/bobvanderlinden/nixpkgs-ruby/blob/master/ruby/versions.json
ruby = pkgs."ruby-2.7.6";
bundixcli = bundix.packages.${system}.default;
in rec {
inherit (rubyNix {
inherit gemset ruby;
name = "my-rails-app";
gemConfig = pkgs.defaultGemConfig // gemConfig;
})
env;
devShells = rec {
default = dev;
dev = pkgs.mkShell {
buildInputs = [ env bundixcli ]
++ (with pkgs; [ yarn rufo ]);
};
};
});
}
Checking if we can close this, so I tried 2.7.6 and bundle is in path.
/tmp/ruby-proj
▲ nix develop
[jane@nixos ruby-proj]$ which bundle
/nix/store/9palvpy1wnj9df2x5hfn1fsphk0aa1vk-my-rails-app/bin/bundle
Hi there,
Not sure If I'm doing something wrong but following the instructions on README I get an environment with ruby but no bundler.
flake.nix
flake.lock
.envrc
Output: