diff --git a/flake.lock b/flake.lock index 36e09ad..791e907 100644 --- a/flake.lock +++ b/flake.lock @@ -26,7 +26,9 @@ }, "deploy-rs": { "inputs": { - "flake-compat": "flake-compat", + "flake-compat": [ + "flake-compat" + ], "nixpkgs": [ "nixpkgs" ], @@ -51,15 +53,15 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1668681692, - "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", - "owner": "edolstra", + "lastModified": 1688025799, + "narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=", + "owner": "nix-community", "repo": "flake-compat", - "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c", "type": "github" }, "original": { - "owner": "edolstra", + "owner": "nix-community", "repo": "flake-compat", "type": "github" } @@ -82,6 +84,27 @@ "type": "github" } }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -170,16 +193,48 @@ "type": "github" } }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": [ + "flake-compat" + ], + "flake-utils": [ + "flake-utils" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1696158581, + "narHash": "sha256-h0vY4E7Lx95lpYQbG2w4QH4yG5wCYOvPJzK93wVQbT0=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "033453f85064ccac434dfd957f95d8457901ecd6", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", "deploy-rs": "deploy-rs", + "flake-compat": "flake-compat", "flake-utils": "flake-utils", "home-manager": "home-manager", "nix-index-database": "nix-index-database", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", - "nur": "nur" + "nur": "nur", + "pre-commit-hooks": "pre-commit-hooks" } }, "systems": { diff --git a/flake.nix b/flake.nix index a97f123..a0a7849 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,7 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; flake-utils.url = "github:numtide/flake-utils"; + flake-compat.url = "github:nix-community/flake-compat"; home-manager.url = "github:nix-community/home-manager/release-23.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; @@ -17,11 +18,18 @@ deploy-rs.url = "github:serokell/deploy-rs"; deploy-rs.inputs.nixpkgs.follows = "nixpkgs"; + deploy-rs.inputs.flake-compat.follows = "flake-compat"; deploy-rs.inputs.utils.follows = "flake-utils"; nix-index-database.url = "github:Mic92/nix-index-database"; nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; + pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; + pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs"; + pre-commit-hooks.inputs.nixpkgs-stable.follows = "nixpkgs"; + pre-commit-hooks.inputs.flake-utils.follows = "flake-utils"; + pre-commit-hooks.inputs.flake-compat.follows = "flake-compat"; + nur.url = "github:nix-community/NUR"; }; @@ -39,7 +47,9 @@ home-manager, nixos-hardware, nix-index-database, + pre-commit-hooks, nur, + ... } @ inputs: let myData = import ./data.nix; mkDeployPkgs = system: @@ -214,9 +224,20 @@ }; }; - checks = builtins.mapAttrs (_system: deployLib: - deployLib.deployChecks self.deploy) - deploy-rs.lib; + checks = + (builtins.mapAttrs (_system: deployLib: + deployLib.deployChecks self.deploy) + deploy-rs.lib) + // { + x86_64-linux.pre-commit-check = inputs.pre-commit-hooks.lib.x86_64-linux.run { + src = ./.; + hooks = { + alejandra.enable = true; + deadnix.enable = true; + #statix.enable = true; + }; + }; + }; } // flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs {inherit system;}; @@ -230,6 +251,7 @@ agenix.packages.${system}.agenix ]; + inherit (inputs.self.checks.x86_64-linux.pre-commit-check) shellHook; }; formatter = pkgs.alejandra;