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 clang 36 installShellFiles 37 ]; 38 39 dontUseCmakeConfigure = true; 40 41 buildPhase = '' 42 # Direct compilation instead of using CMake 43 mkdir -p build 44 $CXX -std=c++17 -O3 -o build/soapdump $src/src/soapdump.cpp 45 ''; 46 47 installPhase = '' 48 mkdir -p $out/bin 49 cp build/soapdump $out/bin/ 50 51 # Generate and install shell completions 52 mkdir -p completions 53 $out/bin/soapdump --generate-bash-completion > completions/soapdump.bash 54 $out/bin/soapdump --generate-zsh-completion > completions/soapdump.zsh 55 $out/bin/soapdump --generate-fish-completion > completions/soapdump.fish 56 57 installShellCompletion --cmd soapdump \ 58 --bash completions/soapdump.bash \ 59 --fish completions/soapdump.fish \ 60 --zsh completions/soapdump.zsh 61 62 # Generate and install man page 63 mkdir -p $out/share/man/man1 64 $out/bin/soapdump --man > $out/share/man/man1/soapdump.1 65 ''; 66 67 meta = with pkgs.lib; { 68 description = "A high-performance PayPal SOAP log parser"; 69 homepage = "https://github.com/taciturnaxolotl/soapdump"; 70 license = licenses.mit; 71 maintainers = with maintainers; [ taciturnaxolotl ]; 72 platforms = platforms.linux ++ platforms.darwin; 73 }; 74 }; 75 in 76 { 77 default = soapdump; 78 } 79 ); 80 81 apps = forAllSystems ( 82 { pkgs }: 83 { 84 default = { 85 type = "app"; 86 program = "${self.packages.${pkgs.system}.default}/bin/soapdump"; 87 }; 88 } 89 ); 90 91 devShells = forAllSystems ( 92 { pkgs }: 93 { 94 default = pkgs.mkShell { 95 buildInputs = with pkgs; [ 96 cmake 97 clang 98 ]; 99 100 shellHook = '' 101 echo "SoapDump development environment loaded" 102 ''; 103 }; 104 } 105 ); 106 107 formatter = forAllSystems ({ pkgs }: pkgs.nixfmt-tree); 108 }; 109}