ts-reverse-proxy/flake.nix
2024-01-29 08:26:35 -07:00

47 lines
1.4 KiB
Nix

{
description = "ts-reverse-proxy: a TailScale aware reverse proxy";
inputs.nixpkgs.url = "github:nixos/nixpkgs";
outputs = { self, nixpkgs }:
let
goVer = "_1_21";
supportedSystems =
[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in {
overlay = final: prev: {
inherit (self.packages.${prev.system}) ts-reverse-proxy;
};
packages = forAllSystems (system:
let pkgs = nixpkgsFor.${system};
buildGoModule = pkgs.buildGo121Module;
in {
ts-reverse-proxy = buildGoModule {
pname = "ts-reverse-proxy";
version = "v1.0.4";
src = ./.;
vendorHash = "sha256-aI5JoW/EEUEUXlypQ+LyUdUdDwBzJQnSr8N0jGexAos=";
};
});
defaultPackage = forAllSystems (system: self.packages.${system}.ts-reverse-proxy);
devShells = forAllSystems (system:
let pkgs = nixpkgsFor.${system};
go = pkgs."go${goVer}";
in {
default = pkgs.mkShell {
shellHook = ''
PS1='\u@\h:\@; '
echo "Go `${go}/bin/go version`"
nix run github:qbit/xin#flake-warn
'';
nativeBuildInputs = with pkgs; [ git go gopls go-tools graphviz ];
};
});
};
}