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.
53 lines
1.4 KiB
Nix
53 lines
1.4 KiB
Nix
{
|
|
config,
|
|
inputs,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
packages = builtins.attrValues {
|
|
inherit (pkgs)
|
|
go # Go compiler and core toolchain
|
|
gocode-gomod # Code completion for Go (modern fork of gocode)
|
|
gotools # Contains godoc, gorename, goimports, etc.
|
|
gore # Go REPL
|
|
gotests # Generate Go tests from function signatures
|
|
gomodifytags # Struct tag manipulation
|
|
golangci-lint # Linter aggregation
|
|
;
|
|
};
|
|
GOPATH = "\${XDG_DATA_HOME}/go";
|
|
in
|
|
{
|
|
options = {
|
|
my.dev.go = {
|
|
enable = lib.mkEnableOption "Install Go 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 Go packages for";
|
|
};
|
|
};
|
|
devShells.go = lib.mkOption {
|
|
type = lib.types.package;
|
|
default = pkgs.mkShell {
|
|
inherit packages GOPATH;
|
|
name = "go-dev-shell";
|
|
shellHook = ''
|
|
echo "🐹 Go dev environment"
|
|
'';
|
|
};
|
|
description = "Go development shell with Emacs tooling, REPL, formatter, and linter";
|
|
};
|
|
};
|
|
config = lib.mkMerge [
|
|
{
|
|
environment.variables = { inherit GOPATH; };
|
|
}
|
|
(lib.mkIf config.my.dev.go.enable {
|
|
users.users = inputs.self.lib.mkUserAttrs lib config.my.dev.go.users { inherit packages; };
|
|
})
|
|
];
|
|
}
|