{"id":20679435,"url":"https://github.com/jmgilman/nix-pre-commit","last_synced_at":"2025-04-19T23:50:13.083Z","repository":{"id":77890378,"uuid":"494863647","full_name":"jmgilman/nix-pre-commit","owner":"jmgilman","description":"Generate pre-commit configurations with your flake.nix","archived":false,"fork":false,"pushed_at":"2023-11-25T13:34:46.000Z","size":8,"stargazers_count":21,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T13:52:09.251Z","etag":null,"topics":["nix","pre-commit","pre-commit-hooks"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmgilman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-21T18:26:04.000Z","updated_at":"2025-02-28T08:35:24.000Z","dependencies_parsed_at":"2023-03-30T13:32:17.809Z","dependency_job_id":null,"html_url":"https://github.com/jmgilman/nix-pre-commit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmgilman%2Fnix-pre-commit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmgilman%2Fnix-pre-commit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmgilman%2Fnix-pre-commit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmgilman%2Fnix-pre-commit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmgilman","download_url":"https://codeload.github.com/jmgilman/nix-pre-commit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249830846,"owners_count":21331357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nix","pre-commit","pre-commit-hooks"],"created_at":"2024-11-16T21:25:58.122Z","updated_at":"2025-04-19T23:50:13.077Z","avatar_url":"https://github.com/jmgilman.png","language":"Nix","readme":"# nix-pre-commit\n\n\u003e Generate [pre-commit][1] configurations with your flake.nix\n\n## Usage\n\nAdd it as an input to your flake and define the pre-commit configuration:\n\n```nix\n{\n  inputs = {\n    flake-utils.url = \"github:numtide/flake-utils\";\n    nixpkgs.url = \"github:nixos/nixpkgs\";\n    nix-pre-commit.url = \"github:jmgilman/nix-pre-commit\";\n  };\n\n  outputs = { self, nixpkgs, flake-utils, nix-pre-commit }:\n    flake-utils.lib.eachDefaultSystem (system:\n      let\n        pkgs = import nixpkgs { inherit system; };\n\n        config = {\n          repos = [\n            {\n              repo = \"local\";\n              hooks = [\n                {\n                  id = \"nixpkgs-fmt\";\n                  entry = \"${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt\";\n                  language = \"system\";\n                  files = \"\\\\.nix\";\n                }\n              ];\n            }\n          ];\n        };\n      in\n      {\n        devShell = pkgs.mkShell {\n          shellHook = (nix-pre-commit.lib.${system}.mkConfig {\n            inherit pkgs config;\n          }).shellHook;\n        };\n      }\n    );\n}\n```\n\nThis produces a `.pre-commit-config.yaml` in the local directory:\n\n```yaml\ndefault_stages:\n  - commit\nrepos:\n  - hooks:\n      - entry: /nix/store/l9vwl9yvjmdj3pixlj5i9kc4524bh78r-nixpkgs-fmt-1.2.0/bin/nixpkgs-fmt\n        files: \\.nix\n        id: nixpkgs-fmt\n        language: system\n        name: nixpkgs-fmt\n    repo: local\n```\n\nThe structure for the configuration specified in `flake.nix` matches the\n[defined structure][2] of the `.pre-commit-config.yaml` file. A small\nbootstrapping script is supplied via a [shellHook][3] which links the generated\nconfig into the local directory and installs the hooks.\n\n## Contributing\n\nCheck out the [issues][4] for items needing attention or submit your own and\nthen:\n\n1. Fork the repo (\u003chttps://github.com/jmgilman/dev-container/fork\u003e)\n2. Create your feature branch (git checkout -b feature/fooBar)\n3. Commit your changes (git commit -am 'Add some fooBar')\n4. Push to the branch (git push origin feature/fooBar)\n5. Create a new Pull Request\n\n[1]: https://pre-commit.com/\n[2]: https://pre-commit.com/#pre-commit-configyaml---hooks\n[3]: https://nixos.org/manual/nix/stable/command-ref/nix-shell.html#description\n[4]: https://github.com/jmgilman/nix-pre-commit/issues\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmgilman%2Fnix-pre-commit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmgilman%2Fnix-pre-commit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmgilman%2Fnix-pre-commit/lists"}