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.
60 lines
1.8 KiB
Nix
60 lines
1.8 KiB
Nix
{
|
||
config,
|
||
inputs,
|
||
lib,
|
||
pkgs,
|
||
...
|
||
}:
|
||
let
|
||
shellType = config.my.shell.type;
|
||
packages = builtins.attrValues {
|
||
inherit (pkgs)
|
||
nixfmt-rfc-style # formatting
|
||
cachix # binary cache management
|
||
nixd # language server for Nix
|
||
deadnix # detext unused/uneeded dependencies
|
||
statix # linter for Nix expressions
|
||
;
|
||
};
|
||
in
|
||
{
|
||
options = {
|
||
my.dev.nix = {
|
||
enable = lib.mkEnableOption "Install Nix 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 Nix packages for";
|
||
};
|
||
};
|
||
devShells.nix = lib.mkOption {
|
||
type = lib.types.package;
|
||
default = pkgs.mkShell {
|
||
inherit packages;
|
||
name = "nix-dev-shell";
|
||
shellHook = ''
|
||
echo "❄️ Nix dev environment"
|
||
'';
|
||
};
|
||
description = "Nix/NixOS development shell with formatter, linter, LSP, and Cachix";
|
||
};
|
||
};
|
||
config = lib.mkIf config.my.dev.nix.enable {
|
||
users.users = inputs.self.lib.mkUserAttrs lib config.my.dev.nix.users { inherit packages; };
|
||
home-manager.users = inputs.self.lib.mkHomeManagerUsers lib config.my.dev.nix.users (_user: {
|
||
programs.${shellType}.shellAliases = inputs.self.lib.mergeAliases inputs.self.lib.commonAliases {
|
||
nixformat = ''
|
||
deadnix -e && \
|
||
nix run nixpkgs#nixfmt-tree && \
|
||
statix fix
|
||
'';
|
||
nix-push-cache = ''
|
||
nix build $NH_FLAKE#nixosConfigurations.${config.networking.hostName}.config.system.build.toplevel \
|
||
--print-out-paths --fallback --max-jobs 100 --cores 0 |
|
||
nix run nixpkgs#attic-client -- push lan:nixos --stdin
|
||
'';
|
||
};
|
||
});
|
||
};
|
||
}
|