templates/local-ruby-nix: update devshell and flake

This commit is contained in:
Gabriel Arazas 2023-11-17 22:08:59 +08:00
parent 6dbe0c2c23
commit 55f9db7599
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
2 changed files with 25 additions and 15 deletions

View File

@ -5,8 +5,11 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
ruby-nix.url = "github:sagittaros/ruby-nix";
ruby-nix.url = "github: inscapist/ruby-nix";
ruby-nix.inputs.nixpkgs.follows = "nixpkgs";
ruby-nix-bundix.url = "github:inscapist/bundix";
ruby-nix-bundix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, ruby-nix, nixpkgs, ... }:
@ -14,10 +17,24 @@
in inputs.flake-utils.lib.eachSystem systems (system:
let
pkgs = import nixpkgs { inherit system; };
gems = ruby-nix.lib pkgs {
name = "ruby-nix-env";
ruby = pkgs.ruby_3_1;
gemset = ./gemset.nix;
};
in
{
devShells.default =
import ./shell.nix { inherit pkgs ruby-nix; };
import ./shell.nix {
inherit pkgs;
extraBuildInputs = [
gems.env
gems.ruby
];
extraPackages = [
inputs.ruby-nix-bundix.packages."${system}".default
];
};
formatter = pkgs.treefmt;
});

View File

@ -1,19 +1,12 @@
{ pkgs ? import <nixpkgs> { }, ruby-nix }:
{ pkgs ? import <nixpkgs> { }
, extraBuildInputs ? [ ]
, extraPackages ? [ ]
}:
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
];
buildInputs = extraBuildInputs;
packages = [
# Formatters
@ -21,5 +14,5 @@ mkShell {
# Language servers
rnix-lsp
];
] ++ extraPackages;
}