46 lines
1.1 KiB
Nix
46 lines
1.1 KiB
Nix
{
|
||
config,
|
||
lib,
|
||
pkgs,
|
||
...
|
||
}:
|
||
let
|
||
shellType = config.my.shell.type;
|
||
packages = builtins.attrValues {
|
||
inherit (pkgs)
|
||
nixfmt-rfc-style # formatting
|
||
nixfmt-tree # 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";
|
||
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.jawz = { inherit packages; };
|
||
home-manager.users.jawz.programs.${shellType}.shellAliases = {
|
||
nixformat = ''
|
||
deadnix -- -e && \
|
||
nixfmt-tree && \
|
||
statix fix
|
||
'';
|
||
};
|
||
};
|
||
}
|