parses paypal soap logs
1{
2 description = "SoapDump - A high-performance PayPal SOAP log parser";
3
4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6 };
7
8 outputs =
9 { self, nixpkgs, ... }:
10 let
11 allSystems = [
12 "x86_64-linux" # 64-bit Intel/AMD Linux
13 "aarch64-linux" # 64-bit ARM Linux
14 "x86_64-darwin" # 64-bit Intel macOS
15 "aarch64-darwin" # 64-bit ARM macOS
16 ];
17 forAllSystems =
18 f:
19 nixpkgs.lib.genAttrs allSystems (
20 system:
21 f {
22 pkgs = import nixpkgs { inherit system; };
23 }
24 );
25 in
26 {
27 packages = forAllSystems (
28 { pkgs }:
29 let
30 version = if self ? rev then self.rev else "0.1.0";
31 soapdump = pkgs.stdenv.mkDerivation {
32 pname = "soapdump";
33 inherit version;
34 src = self;
35
36 nativeBuildInputs = with pkgs; [
37 clang
38 installShellFiles
39 ];
40
41 dontUseCmakeConfigure = true;
42
43 buildPhase = ''
44 # Direct compilation instead of using CMake
45 mkdir -p build
46 $CXX -std=c++17 -O3 -o build/soapdump $src/src/soapdump.cpp
47 '';
48
49 installPhase = ''
50 mkdir -p $out/bin
51 cp build/soapdump $out/bin/
52
53 # Generate and install shell completions
54 mkdir -p completions
55 $out/bin/soapdump --generate-bash-completion > completions/soapdump.bash
56 $out/bin/soapdump --generate-zsh-completion > completions/soapdump.zsh
57 $out/bin/soapdump --generate-fish-completion > completions/soapdump.fish
58
59 installShellCompletion --cmd soapdump \
60 --bash completions/soapdump.bash \
61 --fish completions/soapdump.fish \
62 --zsh completions/soapdump.zsh
63
64 # Generate and install man page
65 mkdir -p $out/share/man/man1
66 $out/bin/soapdump --man > $out/share/man/man1/soapdump.1
67 '';
68
69 meta = with pkgs.lib; {
70 description = "A high-performance PayPal SOAP log parser";
71 homepage = "https://github.com/taciturnaxolotl/soapdump";
72 license = licenses.mit;
73 maintainers = with maintainers; [ taciturnaxolotl ];
74 platforms = platforms.linux ++ platforms.darwin;
75 };
76 };
77 in
78 {
79 default = soapdump;
80 }
81 );
82
83 apps = forAllSystems (
84 { pkgs }:
85 {
86 default = {
87 type = "app";
88 program = "${self.packages.${pkgs.system}.default}/bin/soapdump";
89 };
90 }
91 );
92
93 devShells = forAllSystems (
94 { pkgs }:
95 {
96 default = pkgs.mkShell {
97 buildInputs = with pkgs; [
98 cmake
99 clang
100 self.packages.${pkgs.system}.default
101 ];
102
103 shellHook = ''
104 echo "SoapDump development environment loaded"
105 '';
106 };
107 }
108 );
109
110 formatter = forAllSystems ({ pkgs }: pkgs.nixfmt-tree);
111 };
112}