From ed3bb6d1a3a5387e9fb0949f73cf923c25d9e83d Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Fri, 7 Jul 2023 17:13:32 +0800 Subject: [PATCH] Use ruby-nix for development environment --- flake.lock | 23 ++++++++++++++++++++++- flake.nix | 7 +++++-- shell.nix | 14 +++++++++----- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/flake.lock b/flake.lock index 721509d..784cf12 100644 --- a/flake.lock +++ b/flake.lock @@ -37,7 +37,28 @@ "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "ruby-nix": "ruby-nix" + } + }, + "ruby-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1681695382, + "narHash": "sha256-RBZnSdx3dnUg3o+FiQVKKeKZN6pntYb19mXnnA5b/i8=", + "owner": "sagittaros", + "repo": "ruby-nix", + "rev": "b1edcbec13c9f15915a900b1fb87d9c3ef1e882b", + "type": "github" + }, + "original": { + "owner": "sagittaros", + "repo": "ruby-nix", + "type": "github" } }, "systems": { diff --git a/flake.nix b/flake.nix index fda4707..baad1bb 100644 --- a/flake.nix +++ b/flake.nix @@ -4,9 +4,12 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; + + ruby-nix.url = "github:sagittaros/ruby-nix"; + ruby-nix.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs@{ self, nixpkgs, ... }: + outputs = inputs@{ self, ruby-nix, nixpkgs, ... }: let systems = inputs.flake-utils.lib.defaultSystems; in inputs.flake-utils.lib.eachSystem systems (system: let @@ -14,7 +17,7 @@ in { devShells.default = - import ./shell.nix { inherit pkgs; }; + import ./shell.nix { inherit pkgs ruby-nix; }; formatter = pkgs.treefmt; }); diff --git a/shell.nix b/shell.nix index 3f8e78e..406228a 100644 --- a/shell.nix +++ b/shell.nix @@ -1,17 +1,21 @@ -{ pkgs ? import { } }: +{ pkgs ? import { }, ruby-nix }: with pkgs; let - gems = bundlerEnv { + gems = ruby-nix.lib pkgs { name = "asciidoctor-foodogsquared-extensions"; - gemdir = ./.; + ruby = ruby_3_1; + gemset = ./gemset.nix; }; in mkShell { + buildInputs = [ + gems.env + gems.ruby + ]; + packages = [ - gems - gems.wrappedRuby bundix # Formatters