Use ruby-nix for development environment

This commit is contained in:
Gabriel Arazas 2023-07-07 17:13:32 +08:00
parent 5d651a95a3
commit ed3bb6d1a3
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
3 changed files with 36 additions and 8 deletions

23
flake.lock generated
View File

@ -37,7 +37,28 @@
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "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": { "systems": {

View File

@ -4,9 +4,12 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils"; 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; let systems = inputs.flake-utils.lib.defaultSystems;
in inputs.flake-utils.lib.eachSystem systems (system: in inputs.flake-utils.lib.eachSystem systems (system:
let let
@ -14,7 +17,7 @@
in in
{ {
devShells.default = devShells.default =
import ./shell.nix { inherit pkgs; }; import ./shell.nix { inherit pkgs ruby-nix; };
formatter = pkgs.treefmt; formatter = pkgs.treefmt;
}); });

View File

@ -1,17 +1,21 @@
{ pkgs ? import <nixpkgs> { } }: { pkgs ? import <nixpkgs> { }, ruby-nix }:
with pkgs; with pkgs;
let let
gems = bundlerEnv { gems = ruby-nix.lib pkgs {
name = "asciidoctor-foodogsquared-extensions"; name = "asciidoctor-foodogsquared-extensions";
gemdir = ./.; ruby = ruby_3_1;
gemset = ./gemset.nix;
}; };
in in
mkShell { mkShell {
buildInputs = [
gems.env
gems.ruby
];
packages = [ packages = [
gems
gems.wrappedRuby
bundix bundix
# Formatters # Formatters