An Introduction to Nix for Ruby Developers

This page summarizes the projects mentioned and recommended in the original post on dev.to

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  1. nixpkgs

    Nix Packages collection & NixOS

    let nixpkgs = import (builtins.fetchTarball { url = https://github.com/NixOS/nixpkgs/archive/ee4a6e0f566fe5ec79968c57a9c2c3c25f2cf41d.tar.gz; }) { }; targetRuby = nixpkgs.ruby_3_2; myBundler = nixpkgs.bundler.override { ruby = targetRuby; }; gems = nixpkgs.bundlerEnv { inherit (nixpkgs) ruby_3_2; name = "rails-gems"; bundler = myBundler; gemfile = ./Gemfile; lockfile = ./Gemfile.lock; gemset = ./gemset.nix; }; in nixpkgs.mkShell { buildInputs = [ targetRuby gems gems.wrappedRuby nixpkgs.bundler nixpkgs.bundix nixpkgs.nodejs nixpkgs.yarn nixpkgs.postgresql ]; }

  2. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  3. nixpkgs-ruby

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

  4. devbox

    Instant, easy, and predictable development environments

    A tool to experiment with is devbox. devbox turned a 10-year-old Macbook Pro laptop running macOS Big Sur into a development machine for a modern Rails application in a few minutes. The setup did not include automatic bundling of gems, but it did install Ruby (including bundler and gem), Redis, and PostgreSQL in an isolated and pristine shell environment. devbox eschews a bespoke programming language for configuration and uses JSON. The environment on the MacBook Pro booted from this minimal file named devbox.json:

  5. rubygems

    Library packaging and distribution for Ruby.

    # From gemset.nix # actioncable = { dependencies = ["actionpack" "activesupport" "nio4r" "websocket-driver" "zeitwerk"]; groups = ["default"]; platforms = []; source = { remotes = ["https://rubygems.org"]; sha256 = "0ifiz4nd6a34z2n8lpdgvlgwziy2g364b0xzghiqd3inji0cwqp1"; type = "gem"; }; version = "7.1.3.2"; }; ## From Gemfile.lock # actioncable (7.1.3.2) actionpack (= 7.1.3.2) activesupport (= 7.1.3.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6)

  6. nix

    Nix, the purely functional package manager

    Nix is an entire universe of software. It runs on Linux and macOS, on both Apple Silicon and Intel processors, and has several components:

  7. fish-shell

    The user-friendly command line shell.

    # Launch the `fish` shell (see https://fishshell.com) nix run `nixpkgs#fish` martin@iMac ~/p/o/a/martin (ruby-on-nix)>

  8. devenv

    Fast, Declarative, Reproducible, and Composable Developer Environments

    devenv.sh merits exploration too. It is something of a hybrid, with a JSON-like programming language, YAML configuration, and Docker-like composition of services.

  9. desktop

    Focus on what matters instead of fighting with Git. (by desktop)

    Nix currently is akin to git's "porcelain": powerful but esoteric. However, much like git evolved into exoteric, user-friendly tools such as git-flow, GitHub Desktop, and Tower to become user-friendly, many developers are building abstractions, wrappers, and utilities to simplify Nix usage. Let's briefly look at a few of these tools now.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Flox, a better alternative to Dev Containers

    3 projects | news.ycombinator.com | 25 Oct 2024
  • Tools for Linux Distro Hoppers

    7 projects | dev.to | 27 Mar 2024
  • Show HN: Flox 1.0 – Open-source dev env as code with Nix

    17 projects | news.ycombinator.com | 13 Mar 2024
  • An independent package manager that every hacker deserves

    11 projects | news.ycombinator.com | 29 Nov 2023
  • What is the difference between Immutable Desktops and non Immutable Desktops?

    4 projects | /r/linuxquestions | 30 Apr 2023