rest of the split migration
This commit is contained in:
17
modules/dev/ruby/common.nix
Normal file
17
modules/dev/ruby/common.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ pkgs }:
|
||||
let
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs) ruby;
|
||||
inherit (pkgs.rubyPackages) solargraph;
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit packages;
|
||||
devShell = pkgs.mkShell {
|
||||
inherit packages;
|
||||
name = "ruby-dev-shell";
|
||||
shellHook = ''
|
||||
echo "💎 Ruby dev environment"
|
||||
'';
|
||||
};
|
||||
}
|
||||
39
modules/dev/ruby/home.nix
Normal file
39
modules/dev/ruby/home.nix
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
osConfig ? null,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hm = inputs.self.lib.hmModule {
|
||||
inherit
|
||||
config
|
||||
inputs
|
||||
osConfig
|
||||
;
|
||||
optionPath = [
|
||||
"dev"
|
||||
"ruby"
|
||||
];
|
||||
};
|
||||
cfg = config.my.dev.ruby;
|
||||
feature = import ./common.nix { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
options.my.dev.ruby.enable = lib.mkEnableOption "Install Ruby tooling globally";
|
||||
config = lib.mkMerge [
|
||||
{
|
||||
my.dev.ruby.enable = lib.mkDefault hm.enabledByDefault;
|
||||
}
|
||||
(lib.mkIf cfg.enable {
|
||||
home.packages = feature.packages;
|
||||
home.sessionVariables = {
|
||||
GEM_HOME = "${config.xdg.dataHome}/ruby/gems";
|
||||
GEM_PATH = "${config.xdg.dataHome}/ruby/gems";
|
||||
GEM_SPEC_CACHE = "${config.xdg.dataHome}/ruby/specs";
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
27
modules/dev/ruby/nixos.nix
Normal file
27
modules/dev/ruby/nixos.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
feature = import ./common.nix { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
options = {
|
||||
my.dev.ruby = {
|
||||
enable = lib.mkEnableOption "Install Ruby tooling globally";
|
||||
users = lib.mkOption {
|
||||
type = inputs.self.lib.usersOptionType lib;
|
||||
default = config.my.toggleUsers.dev;
|
||||
description = "Users to install Ruby packages for";
|
||||
};
|
||||
};
|
||||
devShells.ruby = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = feature.devShell;
|
||||
description = "Ruby development shell with interpreter and Solargraph LSP";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user