Updated multiple configuration files to replace the user option type with a unified `usersOptionType`, enhancing consistency in user management across applications and services. This change simplifies the user configuration process and improves maintainability.
49 lines
1.2 KiB
Nix
49 lines
1.2 KiB
Nix
{
|
|
config,
|
|
inputs,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
packages = builtins.attrValues {
|
|
inherit (pkgs) ruby; # Ruby interpreter
|
|
inherit (pkgs.rubyPackages) solargraph; # LSP for Ruby
|
|
};
|
|
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 = pkgs.mkShell {
|
|
inherit packages;
|
|
name = "ruby-dev-shell";
|
|
shellHook = ''
|
|
echo "💎 Ruby dev environment"
|
|
'';
|
|
};
|
|
description = "Ruby development shell with interpreter and Solargraph LSP";
|
|
};
|
|
};
|
|
config = lib.mkMerge [
|
|
(lib.mkIf config.my.dev.ruby.enable {
|
|
users.users = inputs.self.lib.mkUserAttrs lib config.my.dev.ruby.users { inherit packages; };
|
|
})
|
|
{
|
|
environment.variables = {
|
|
GEM_HOME = "\${XDG_DATA_HOME}/ruby/gems";
|
|
GEM_PATH = "\${XDG_DATA_HOME}/ruby/gems";
|
|
GEM_SPEC_CACHE = "\${XDG_DATA_HOME}/ruby/specs";
|
|
};
|
|
}
|
|
];
|
|
}
|