From c3283314b789b62e5901ffd06198df2926e8434a Mon Sep 17 00:00:00 2001 From: Jordan Holt Date: Sun, 19 Jan 2025 11:02:07 +0000 Subject: [PATCH] Add formatter and pre-commit hooks --- flake.lock | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 6 ++++++ 2 files changed, 66 insertions(+) diff --git a/flake.lock b/flake.lock index dfeaa22..6c93c52 100644 --- a/flake.lock +++ b/flake.lock @@ -182,6 +182,22 @@ "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" } }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -286,6 +302,27 @@ "type": "github" } }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -605,6 +642,28 @@ "type": "github" } }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_4", + "gitignore": "gitignore_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1737043064, + "narHash": "sha256-I/OuxGwXwRi5gnFPsyCvVR+IfFstA+QXEpHu1hvsgD8=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "94ee657f6032d913fe0ef49adaa743804635b0bb", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", @@ -620,6 +679,7 @@ "nixpkgs-unstable": "nixpkgs-unstable", "nixvim": "nixvim", "plasma-manager": "plasma-manager", + "pre-commit-hooks": "pre-commit-hooks", "secrets": "secrets", "thunderbird-gnome-theme": "thunderbird-gnome-theme" } diff --git a/flake.nix b/flake.nix index 7e28930..891695e 100644 --- a/flake.nix +++ b/flake.nix @@ -41,6 +41,10 @@ inputs.nixpkgs.follows = "nixpkgs"; inputs.home-manager.follows = "home-manager"; }; + pre-commit-hooks = { + url = "github:cachix/git-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; secrets = { url = "git+ssh://git@git.vimium.com/jordan/nix-secrets.git"; flake = false; @@ -101,6 +105,8 @@ })) ]; + formatter = forEachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); + devShells.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.mkShell { buildInputs = [ inputs.agenix.packages.x86_64-linux.agenix