Skip to content

feat(nix): Implement nix-home-manager-check hook #18

@aRustyDev

Description

@aRustyDev

Description

Implement a pre-commit hook for testing home-manager configurations.

Requirements

  • Validate home.nix and home-manager module files
  • Support home-manager build with dry-run
  • Handle both standalone and NixOS/darwin module usage
  • Support flake-based home-manager configurations
  • Clear error reporting for configuration errors

Implementation Details

  • Location: hooks/nix/nix-home-manager-check.sh
  • Language: bash script
  • File patterns: home.nix, home-manager/*.nix, users/*.nix

Testing

  • Test with valid home configuration
  • Test with invalid home-manager options
  • Test with missing programs/services
  • Test with both flake and legacy setups
  • Test module imports and dependencies

Configuration in .pre-commit-hooks.yaml

- id: nix-home-manager-check
  name: Check home-manager configuration
  description: Validates home-manager configurations
  entry: hooks/nix/nix-home-manager-check.sh
  language: script
  files: (home|users/.*|home-manager/.*)\.nix$

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions