Files
nix-dotfiles/shell.nix
T

65 lines
1.4 KiB
Nix
Raw Normal View History

2024-05-19 23:32:52 -04:00
{
2024-05-19 23:38:11 -04:00
inputs,
2024-05-19 23:32:52 -04:00
forEachSystem,
checks,
...
}:
forEachSystem (
system:
let
2024-05-19 23:38:11 -04:00
inherit (inputs) nixpkgs sops-nix;
2024-05-19 23:32:52 -04:00
pkgs = nixpkgs.legacyPackages.${system};
2024-05-20 01:22:45 -04:00
# construct the shell provided by pre-commit for running hooks
2024-05-19 23:32:52 -04:00
pre-commit = pkgs.mkShell {
shellHook = ''
if [ -f ./.noprecommit ]; then
echo ".noprecommit found! Delete this file to re-install pre-commit hooks"
if [ -f ./.pre-commit-config.yaml ]; then
echo "uninstalling pre-commit hooks"
pre-commit uninstall
rm .pre-commit-config.yaml
fi
else
${checks.${system}.pre-commit-check.shellHook}
fi
'';
2024-05-19 23:32:52 -04:00
buildInputs = checks.${system}.pre-commit-check.enabledPackages;
};
2024-05-20 01:22:45 -04:00
# construct a shell for importing sops keys (also provides the sops binary)
2024-05-19 23:32:52 -04:00
sops = pkgs.mkShell {
sopsPGPKeyDirs = [ "./keys" ];
packages = [
pkgs.sops
sops-nix.packages.${system}.sops-import-keys-hook
];
};
2024-05-20 01:22:45 -04:00
# constructs a custom shell with commonly used utilities
2025-04-01 13:59:09 -04:00
adev = pkgs.mkShell {
2024-05-19 23:32:52 -04:00
packages = with pkgs; [
deadnix
pre-commit
treefmt
statix
nixfmt
2025-03-13 17:43:41 -04:00
jsonfmt
mdformat
shfmt
yamlfmt
2024-05-19 23:32:52 -04:00
];
};
in
{
default = pkgs.mkShell {
inputsFrom = [
pre-commit
2025-04-01 13:59:09 -04:00
adev
2024-05-19 23:32:52 -04:00
sops
];
};
}
)