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