templates/local-ruby-nix: init

This commit is contained in:
Gabriel Arazas 2023-08-03 15:44:11 +08:00
parent 3fc2d6dbc3
commit cae874e52f
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
4 changed files with 65 additions and 0 deletions

View File

@ -460,6 +460,10 @@
path = ./templates/sample-nixos-template; path = ./templates/sample-nixos-template;
description = "Simple sample Nix flake with NixOS and home-manager"; description = "Simple sample Nix flake with NixOS and home-manager";
}; };
local-ruby-nix = {
path = ./templates/local-ruby-nix;
description = "Local Ruby app development with ruby-nix";
};
}; };
# No amount of formatters will make this codebase nicer but it sure does # No amount of formatters will make this codebase nicer but it sure does

View File

@ -0,0 +1,12 @@
source 'https://rubygems.org'
gemspec
group :development do
gem 'rake'
gem 'ruby-lsp', require: false
end
group :lint do
gem 'rubocop', require: false
end

View File

@ -0,0 +1,24 @@
{
description = "Basic flake template for setting up development shells";
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, ruby-nix, nixpkgs, ... }:
let systems = inputs.flake-utils.lib.defaultSystems;
in inputs.flake-utils.lib.eachSystem systems (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
devShells.default =
import ./shell.nix { inherit pkgs ruby-nix; };
formatter = pkgs.treefmt;
});
}

View File

@ -0,0 +1,25 @@
{ pkgs ? import <nixpkgs> { }, ruby-nix }:
with pkgs;
let
gems = ruby-nix.lib pkgs {
name = "ruby-nix-env";
ruby = ruby_3_1;
gemset = ./gemset.nix;
};
in
mkShell {
buildInputs = [
gems.env
gems.ruby
];
packages = [
# Formatters
nixpkgs-fmt
# Language servers
rnix-lsp
];
}