ChanServ changed the topic of #nixos-ruby to: Everything about using Nix & Ruby. Logs at https://logs.nix.samueldr.com/nixos-ruby/
pbb has joined #nixos-ruby
pbb has quit [Excess Flood]
rickhull has joined #nixos-ruby
<rickhull> manveru: looking at https://manveru.dev/blog/Ruby%20-%20Nix.html - I am getting an error with the `shell.nix` code
<rickhull> error: value is a function while a set was expected, at /home/rwh/git/ballistics/shell.nix:9:4
pbb has joined #nixos-ruby
<rickhull> somewhat related, and more generally: I am trying to use nixos as a development platform. I have some gems I'd like to update, e.g. `git clone $GITHUB_URL`
<rickhull> I am pretty new to nixos and mostly used to Debian
<rickhull> on Debian, I make sure the ruby package is installed, and that gives me rake and some other things, or I can use a newer rake gem
<rickhull> right off the bat, I'd like to be able to run the tests, e.g. `rake test` for the newly cloned gem
<rickhull> but I need to have an environment that will have all dependencies satisfied. on Debian systems, this is basically running some `apt install` and `gem install` commands
<rickhull> then I can generally just `ruby -Ilib test/*.rb`
<rickhull> or `rake test`
<rickhull> now, I am trying to do that dev environment stuff with `nix-shell`
<rickhull> for a specific example: `git clone https://github.com/rickhull/ballistics`
<rickhull> this includes a C extension
<rickhull> the gemspec lists a development_dependency on rake-compiler
<rickhull> there is no Gemfile for this or most of my gems
<rickhull> to get to a point where I can `rake test` after `git clone`:
<rickhull> i need to have `rake` -- I am using ruby.withPackages for this in my shell.nix
<rickhull> one question, how do I specify a newer rake? right now it gives me rake-10.5.0
<rickhull> with `rake`, I can run `rake compile` to compile the C extension (note -- I may have previously done `gem install rake-compiler`)
<rickhull> at that point, `rake test` should work
<rickhull> `gem list rake` : `rake (13.0.1, 10.5.0)`
<rickhull> I believe I have installed 13.0.1 via `gem install rake` (but it's not in my PATH)
<rickhull> so I'm really fuzzy on how gems get installed, selected, and into PATH -- using nix-shell vs `gem install`
<rickhull> can anyone offer some insight, or how you would go about `git clone https://github.com/rickhull/ballistics` and getting to `rake test`
<rickhull> oh -- I guess I'm leaving out that on Debian I would use chruby -- and I believe that helps with adding user-installed gems to the user's PATH
pbb has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
pbb has joined #nixos-ruby
<manveru> rickhull: i'll be able to help in a bit, barley up yet :)
pbb has quit [Remote host closed the connection]
pbb has joined #nixos-ruby
pbb has joined #nixos-ruby
<manveru> rickhull: so... for this specific example you'll need a Gemfile
<manveru> and you were missing the `minitest` dependency
<manveru> also thanks, there was a mistake in my blog post...
<rickhull> manveru: what's the fix? xD
<manveru> and some more :)
<manveru> i'll squash it in a bit
<manveru> guess it would be nice to have some example project that shows how i usually set up all this stuff
<rickhull> yes, and I have some ideas / complaints about making some docs more noob friendly
<manveru> yeah...
<manveru> alright, that should be the final one for now
<manveru> there's a lot of boilerplate unfortunately
<rickhull> yes, but I suppose that's the tradeoff for specifying $EVERYTHING
<manveru> pretty much
<manveru> so the Gemfile is mostly so `bundix` can generate a `gemset.nix`, which has hashes for each gem
<manveru> since bundler won't add hashes to its lockfiles for some reason
<rickhull> I am still taking this in, and it's late for me and I've had a few.... but I have some general questions
<manveru> the `niv` stuff is for hashing other dependencies (in this case nixpkgs)
<manveru> sure
<rickhull> you helped me add rake to my nix-shell, but it is 10.5.0
<rickhull> what controls that?
<rickhull> with import <nixpkgs> {};ruby.withPackages (p: [ p.rake ])
<manveru> the rake in this nix-shell is `13.0.1`
<manveru> the one in nixpkgs is older, since it has to be compatible with a few hundred other gems
<rickhull> ah, ok, so that's my stable nixpkgs channel?
<manveru> yes
<manveru> that's what `<nixpkgs>` is, it gets the `nixpkgs` value from your `NIX_PATH` environment variable or channel
<manveru> so just specifying that, will not be very pure or reproducible
<manveru> since when you update your channels, your project will change behaviour
<rickhull> ok
<manveru> that's what the `niv` part is for
<manveru> with the stuff in the `nix` folder in my commit
<rickhull> what is niv, in a nutshell?
<rickhull> also, been treating this as my main info source: https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/ruby.section.md
<manveru> `niv` generates a `sources.json` file with urls and hashes for downloading arbitrary dependencies and a nice way to manage them
<manveru> it also makes a `sources.nix` file that lets you import those dependencies into nix code easily
<manveru> yeah, the main docs should be better :)
<rickhull> ok
<rickhull> what is the error with function vs. set in the shell.nix example from your blogpost? I am just trying to understand
<manveru> i forgot to call it
<rickhull> the error message makes it tough to diagnose
<manveru> the `import (...)` should be `import (...) {}`
<manveru> indeed
<rickhull> I have to say, it's difficult to read Nix outside of the main examples. in terms of predicting or anticipating behavior
<rickhull> i can grasp at some really nice properties that make for a really nice system
<rickhull> but the dusty crevices are indeed dusty xD
<manveru> lol
<manveru> yeah... there's still some way to go to make it sexy and shiny
<manveru> but the error reporting is probably my biggest complaint as well
<rickhull> I added empty braces to the import
<rickhull> error: getting status of '/home/rwh/git/ballistics/gemset.nix': No such file or directory
<rickhull> now, I can see `gemset.nix` in your commit
<manveru> that's generated using `bundix -l`
<rickhull> let's take a step back for a sec. why isn't the .gemspec enough?
<rickhull> is it because parsing .gemspec is harder than parsing Gemfile ?
<rickhull> should I have to declare dependencies twice?
zarel has joined #nixos-ruby
zarel_ has joined #nixos-ruby
zarel has quit [Ping timeout: 246 seconds]
zarel_ has quit [Ping timeout: 258 seconds]
zarel has joined #nixos-ruby
rickhull has quit [Remote host closed the connection]
rickhull has joined #nixos-ruby
rickhull has quit [Remote host closed the connection]
pbb has quit [Remote host closed the connection]
pbb has joined #nixos-ruby