Enhanced the configuration files to support multi-user management by introducing user options for multiple applications, including art, gaming, multimedia, and development tools. Updated existing modules to utilize these new user options, improving flexibility and maintainability in user package installations.
50 lines
1.2 KiB
Nix
50 lines
1.2 KiB
Nix
{
|
|
config,
|
|
inputs,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
packages = builtins.attrValues {
|
|
inherit (pkgs)
|
|
rustc # Rust compiler
|
|
cargo # Rust package manager
|
|
rust-analyzer # Language server for Rust
|
|
clippy # Linter for Rust
|
|
rustfmt # Formatter for Rust code
|
|
;
|
|
};
|
|
in
|
|
{
|
|
options = {
|
|
my.dev.rust = {
|
|
enable = lib.mkEnableOption "Install Rust tooling globally";
|
|
users = lib.mkOption {
|
|
type = lib.types.either lib.types.str (lib.types.listOf lib.types.str);
|
|
default = config.my.toggleUsers.dev;
|
|
description = "Users to install Rust packages for";
|
|
};
|
|
};
|
|
devShells.rust = lib.mkOption {
|
|
type = lib.types.package;
|
|
default = pkgs.mkShell {
|
|
inherit packages;
|
|
name = "rust-dev-shell";
|
|
shellHook = ''
|
|
echo "🦀 Rust dev environment"
|
|
'';
|
|
};
|
|
description = "Rust development shell with cargo and rust-analyzer";
|
|
};
|
|
};
|
|
config = lib.mkMerge [
|
|
(lib.mkIf config.my.dev.rust.enable {
|
|
users.users = inputs.self.lib.mkUserAttrs lib config.my.dev.rust.users { inherit packages; };
|
|
})
|
|
{
|
|
environment.variables.CARGO_HOME = "\${XDG_DATA_HOME}/cargo";
|
|
}
|
|
];
|
|
}
|