mirror of
https://github.com/anotherhadi/spilltea.git
synced 2026-05-20 17:52:33 +02:00
Move pre-commit hooks to nix
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
.claude/
|
||||
CLAUDE.md
|
||||
result/
|
||||
.pre-commit-config.yaml
|
||||
|
||||
Generated
+115
@@ -1,5 +1,103 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1767039857,
|
||||
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
|
||||
"owner": "NixOS",
|
||||
"repo": "flake-compat",
|
||||
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"git-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1778507602,
|
||||
"narHash": "sha256-kTwur1wV+01SdqskVMSo6JMEpg71ps3HpbFY2GsflKs=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "61ab0e80d9c7ab14c256b5b453d8b3fb0189ba0a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"git-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"
|
||||
}
|
||||
},
|
||||
"gomod2nix": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1770585520,
|
||||
"narHash": "sha256-yBz9Ozd5Wb56i3e3cHZ8WcbzCQ9RlVaiW18qDYA/AzA=",
|
||||
"owner": "nix-community",
|
||||
"repo": "gomod2nix",
|
||||
"rev": "1201ddd1279c35497754f016ef33d5e060f3da8d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "gomod2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1777954456,
|
||||
@@ -18,8 +116,25 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"git-hooks": "git-hooks",
|
||||
"gomod2nix": "gomod2nix",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
||||
@@ -1,55 +1,41 @@
|
||||
{
|
||||
description = "Spilltea: A minimal, terminal-based HTTP(S) proxy for pentesters and CTF players.";
|
||||
|
||||
inputs = {nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";};
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
gomod2nix = {
|
||||
url = "github:nix-community/gomod2nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
git-hooks = {
|
||||
url = "github:cachix/git-hooks.nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
gomod2nix,
|
||||
git-hooks,
|
||||
}: let
|
||||
supportedSystems = ["x86_64-linux" "aarch64-linux"];
|
||||
|
||||
forAllSystems = f:
|
||||
nixpkgs.lib.genAttrs supportedSystems
|
||||
(system: f system (import nixpkgs {inherit system;}));
|
||||
|
||||
pname = "spilltea";
|
||||
version = "0.0.5";
|
||||
|
||||
ldflags = ["-s" "-w" "-X main.version=${version}"];
|
||||
in {
|
||||
packages = forAllSystems (system: pkgs: let
|
||||
pkg = pkgs.buildGoModule {
|
||||
inherit pname version ldflags;
|
||||
|
||||
src = ./.;
|
||||
outputs = ["out"];
|
||||
|
||||
vendorHash = "sha256-1iPwFsyzdonak9EWMRnudwcCQZfI+Uvre38+puG4s0s=";
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
description = "A minimal, terminal-based HTTP(S) proxy for pentesters and CTF players.";
|
||||
homepage = "https://github.com/anotherhadi/spilltea";
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
};
|
||||
in {
|
||||
"${pname}" = pkg;
|
||||
default = pkg;
|
||||
});
|
||||
packages = forAllSystems (system: pkgs:
|
||||
import ./nix/package.nix {
|
||||
inherit pkgs;
|
||||
buildGoApplication = gomod2nix.legacyPackages.${system}.buildGoApplication;
|
||||
});
|
||||
|
||||
devShells = forAllSystems (system: pkgs: {
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
go
|
||||
python3
|
||||
lefthook
|
||||
doctoc
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
lefthook install
|
||||
'';
|
||||
default = import ./nix/shell.nix {
|
||||
inherit pkgs;
|
||||
gitHooksLib = git-hooks.lib.${system};
|
||||
gomod2nixPkgs = gomod2nix.legacyPackages.${system};
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
pre-commit:
|
||||
piped: true
|
||||
commands:
|
||||
check-vendor-hash:
|
||||
glob: "{go.mod,go.sum}"
|
||||
run: .github/scripts/check-vendor-hash.sh
|
||||
stage_fixed: true
|
||||
inject-exec-basics:
|
||||
glob: "{docs/basics.md,cmd/**}"
|
||||
run: python3 .github/scripts/inject-exec.py docs/basics.md
|
||||
stage_fixed: true
|
||||
inject-exec:
|
||||
glob: "{README.md,docs/basics.md,cmd/**}"
|
||||
run: python3 .github/scripts/inject-exec.py README.md
|
||||
stage_fixed: true
|
||||
toc:
|
||||
glob: "{README.md,docs/basics.md,cmd/**}"
|
||||
run: doctoc --notitle README.md
|
||||
stage_fixed: true
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
pkgs,
|
||||
buildGoApplication,
|
||||
}: let
|
||||
pname = "spilltea";
|
||||
version = "0.0.5";
|
||||
ldflags = ["-s" "-w" "-X main.version=${version}"];
|
||||
pkg = buildGoApplication {
|
||||
inherit pname version ldflags;
|
||||
src = ../.;
|
||||
modules = ./gomod2nix.toml;
|
||||
meta = with pkgs.lib; {
|
||||
description = "A minimal, terminal-based HTTP(S) proxy for pentesters and CTF players.";
|
||||
homepage = "https://github.com/anotherhadi/spilltea";
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
};
|
||||
in {
|
||||
"${pname}" = pkg;
|
||||
default = pkg;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
pkgs,
|
||||
gitHooksLib,
|
||||
gomod2nixPkgs,
|
||||
}: let
|
||||
hooks = gitHooksLib.run {
|
||||
src = ../.;
|
||||
hooks = {
|
||||
gofmt.enable = true;
|
||||
govet.enable = true;
|
||||
|
||||
gomod2nix = {
|
||||
enable = true;
|
||||
name = "gomod2nix";
|
||||
entry = "gomod2nix --outdir ./nix";
|
||||
language = "system";
|
||||
files = "go\\.(mod|sum)$";
|
||||
pass_filenames = false;
|
||||
};
|
||||
|
||||
inject-exec-basics = {
|
||||
enable = true;
|
||||
name = "inject-exec-basics";
|
||||
entry = "python3 .github/scripts/inject-exec.py docs/basics.md";
|
||||
language = "system";
|
||||
files = "(docs/basics\\.md|cmd/)";
|
||||
pass_filenames = false;
|
||||
};
|
||||
|
||||
inject-exec = {
|
||||
enable = true;
|
||||
name = "inject-exec";
|
||||
entry = "python3 .github/scripts/inject-exec.py README.md";
|
||||
language = "system";
|
||||
files = "(README\\.md|docs/basics\\.md|cmd/)";
|
||||
pass_filenames = false;
|
||||
};
|
||||
|
||||
doctoc = {
|
||||
enable = true;
|
||||
name = "doctoc";
|
||||
entry = "doctoc --notitle README.md";
|
||||
language = "system";
|
||||
files = "(README\\.md|docs/basics\\.md|cmd/)";
|
||||
pass_filenames = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
pkgs.mkShell {
|
||||
packages = with pkgs;
|
||||
[
|
||||
go
|
||||
python3
|
||||
doctoc
|
||||
gomod2nixPkgs.gomod2nix
|
||||
]
|
||||
++ hooks.enabledPackages;
|
||||
|
||||
shellHook = hooks.shellHook;
|
||||
}
|
||||
Reference in New Issue
Block a user