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.
60 lines
1.7 KiB
Nix
60 lines
1.7 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 = inputs.self.lib.usersOptionType lib;
|
||
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
|
||
'';
|
||
};
|
||
});
|
||
};
|
||
}
|