a (hacky, wip) multi-tenant oidc-terminating reverse proxy, written in anger on top of pingora

add flake build output for deploying with nix

+53 -2
+3
.gitignore
··· 4 4 # vim 5 5 *~ 6 6 *.swp 7 + 8 + # nix 9 + /result
+16
flake.lock
··· 1 1 { 2 2 "nodes": { 3 + "crane": { 4 + "locked": { 5 + "lastModified": 1771121070, 6 + "narHash": "sha256-aIlv7FRXF9q70DNJPI237dEDAznSKaXmL5lfK/Id/bI=", 7 + "owner": "ipetkov", 8 + "repo": "crane", 9 + "rev": "a2812c19f1ed2e5ed5ce2ef7109798b575c180e1", 10 + "type": "github" 11 + }, 12 + "original": { 13 + "owner": "ipetkov", 14 + "repo": "crane", 15 + "type": "github" 16 + } 17 + }, 3 18 "nixpkgs": { 4 19 "locked": { 5 20 "lastModified": 1771119812, ··· 33 48 }, 34 49 "root": { 35 50 "inputs": { 51 + "crane": "crane", 36 52 "nixpkgs": "nixpkgs", 37 53 "rust-overlay": "rust-overlay" 38 54 }
+34 -2
flake.nix
··· 1 1 { 2 - description = "A replacement for the man tool"; 2 + description = "An oauth2/oidc1 proxy, written in anger"; 3 3 4 4 # Flake inputs 5 5 inputs = { 6 6 nixpkgs.url = "github:NixOS/nixpkgs"; # also valid: "nixpkgs" 7 7 rust-overlay.url = "github:oxalica/rust-overlay"; # A helper for Rust + Nix 8 + 9 + # crane, for nicer caching when building rust 10 + crane.url = "github:ipetkov/crane"; 8 11 }; 9 12 10 13 # Flake outputs 11 - outputs = { self, nixpkgs, rust-overlay }: 14 + outputs = { self, nixpkgs, rust-overlay, crane }: 12 15 let 13 16 # Overlays enable you to customize the Nixpkgs attribute set 14 17 overlays = [ ··· 20 23 rustToolchain = super.rust-bin.stable.latest.default.override { 21 24 extensions = [ "rust-analyzer" "rust-src" "rust-docs" ]; 22 25 }; 26 + minimalRustToolchain = super.rust-bin.stable.latest.minimal; 23 27 }) 24 28 ]; 25 29 ··· 49 53 protobuf 50 54 ]) ++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ libiconv ]); 51 55 }; 56 + }); 57 + 58 + packages = forAllSystems ({ pkgs }: { 59 + default = let 60 + craneLib = (crane.mkLib pkgs).overrideToolchain pkgs.minimalRustToolchain; 61 + commonArgs = { 62 + src = pkgs.lib.cleanSourceWith { 63 + src = ./.; 64 + filter = 65 + let 66 + protoFilter = path: _type: builtins.match ".*\.proto" path != null; 67 + in 68 + path: type: (protoFilter path type) || (craneLib.filterCargoSources path type); 69 + name = "source"; 70 + }; 71 + nativeBuildInputs = with pkgs; [ 72 + # for one of our rust deps 73 + cmake 74 + # for building our config 75 + protobuf 76 + ]; 77 + }; 78 + in 79 + craneLib.buildPackage ({ 80 + name = "proxy-in-anger"; 81 + version = "0.0.1"; 82 + cargoArtifacts = craneLib.buildDepsOnly commonArgs; 83 + } // commonArgs); 52 84 }); 53 85 }; 54 86 }