Description
Implement a pre-commit hook to validate Nix flakes using nix flake check.
Requirements
- Check for nix command availability with flakes enabled
- Run nix flake check on flake.nix files
- Support both local and remote flakes
- Provide clear error messages for validation failures
- Handle cases where experimental features might not be enabled
Implementation Details
- Location: hooks/nix/nix-flake-check.sh
- Language: bash script
- File pattern: flake.nix
Testing
- Test with valid flake.nix
- Test with invalid flake.nix
- Test with missing inputs
- Test with evaluation errors
Configuration in .pre-commit-hooks.yaml
- id: nix-flake-check
name: Check Nix flakes
description: Validates Nix flakes using 'nix flake check'
entry: hooks/nix/nix-flake-check.sh
language: script
files: flake\.nix$
Reactions are currently unavailable
Description
Implement a pre-commit hook to validate Nix flakes using nix flake check.
Requirements
Implementation Details
Testing
Configuration in .pre-commit-hooks.yaml