diff --git a/flake.lock b/flake.lock index 70c93f6..b55bae8 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "flake-compat": { + "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": [ @@ -20,6 +36,50 @@ "type": "github" } }, + "git-hooks-nix": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1733665616, + "narHash": "sha256-+XTFXYlFJBxohhMGLDpYdEnhUNdxN8dyTA8WAd+lh2A=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "d8c02f0ffef0ef39f6063731fc539d8c71eb463a", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "git-hooks-nix", + "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" + } + }, "nixpkgs": { "locked": { "lastModified": 1733808091, @@ -36,9 +96,26 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1730741070, + "narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d063c1dd113c91ab27959ba540c0d9753409edf3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "flake-parts": "flake-parts", + "git-hooks-nix": "git-hooks-nix", "nixpkgs": "nixpkgs", "treefmt-nix": "treefmt-nix" } diff --git a/flake.nix b/flake.nix index 652daee..7ffb098 100644 --- a/flake.nix +++ b/flake.nix @@ -25,6 +25,7 @@ inputs@{ flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } { imports = [ + ./nix/checks/flake-module.nix ./nix/devshells/flake-module.nix ./nix/formatter/flake-module.nix ./nix/packages/flake-module.nix diff --git a/nix/checks/flake-module.nix b/nix/checks/flake-module.nix new file mode 100644 index 0000000..b66ddaa --- /dev/null +++ b/nix/checks/flake-module.nix @@ -0,0 +1,34 @@ +{ + perSystem = + { + self', + lib, + pkgs, + config, + ... + }: + { + checks = + let + packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages; + devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells; + in + packages + // devShells + // { + golangci-lint = config.packages.ncps.overrideAttrs (oa: { + name = "golangci-lint"; + src = ../../.; + nativeBuildInputs = oa.nativeBuildInputs ++ [ pkgs.golangci-lint ]; + buildPhase = '' + HOME=$TMPDIR + golangci-lint run --timeout 10m + ''; + installPhase = '' + touch $out + ''; + doCheck = false; + }); + }; + }; +}