Skip to content

Commit

Permalink
✨ (flake-basic/) Update template of flake-basic
Browse files Browse the repository at this point in the history
  • Loading branch information
Comamoca committed Nov 23, 2024
1 parent ebc7808 commit ea71b7d
Show file tree
Hide file tree
Showing 2 changed files with 143 additions and 23 deletions.
131 changes: 111 additions & 20 deletions flake-basic/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 32 additions & 3 deletions flake-basic/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@
treefmt-nix.url = "github:numtide/treefmt-nix";
flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default";
git-hooks-nix.url = "github:cachix/git-hooks.nix";
};

outputs =
inputs@{
self,
systems,
nixpkgs,
treefmt-nix,
flake-parts,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ treefmt-nix.flakeModule ];
imports = [
inputs.treefmt-nix.flakeModule
inputs.git-hooks-nix.flakeModule
];
systems = import inputs.systems;

perSystem =
Expand Down Expand Up @@ -58,8 +62,16 @@
install -D $src/bin/hello $out/bin/hello
'';
};

git-secrets' = pkgs.writeShellApplication {
name = "git-secrets";
runtimeInputs = [ pkgs.git-secrets ];
text = ''
git secrets --scan
'';
};
in
rec {
{
# When execute `nix fmt`, formatting your code.
treefmt = {
projectRootFile = "flake.nix";
Expand All @@ -70,6 +82,23 @@
settings.formatter = { };
};

pre-commit = {
check.enable = true;
settings = {
hooks = {
treefmt.enable = true;
ripsecrets.enable = true;
git-secrets = {
enable = true;
name = "git-secrets";
entry = "${git-secrets'}/bin/git-secrets";
language = "system";
types = [ "text" ];
};
};
};
};

# When execute `nix develop`, you go in shell installed nil.
devShells.default = pkgs.mkShell {
packages = with pkgs; [
Expand Down

0 comments on commit ea71b7d

Please sign in to comment.