{
  sources ? import ./lon.nix,
  pkgs ? import sources.nixpkgs { },
}:
let
  policy = builtins.toFile "policy.hujson" (builtins.readFile ./attic/policy.hujson);
  gh = pkgs.fetchFromGitHub {
    owner = "SimplyMinimal";
    repo = "tailscale-network-topology-mapper";
    rev = "v2.0.1";
    hash = "sha256-55n7CERdI2LPtSLAQJnGuqM27MWjq2Ef1c8uhndX0Qk=";
  };
  combinedSrc = pkgs.runCommand "combined-src" { } ''
    mkdir -p $out
    cp -r ${gh}/* $out/
    ls -l $out/
    rm $out/policy.hujson
    cp ${policy} $out/policy.hujson
  '';
in
{
  tailscale-visualizer = pkgs.stdenv.mkDerivation {
    pname = "tailscale-visualizer";
    version = "v2.0.1";

    src = combinedSrc;

    nativeBuildInputs = with pkgs.python3Packages; [
      pyvis
      hjson
      pytest
    ];

    buildPhase = ''
      ${pkgs.lib.getExe pkgs.python3} main.py
    '';

    installPhase = ''
      mkdir -p $out
      cp network_topology.html $out/
    '';

    env = ''
      TS_COMPANY_DOMAIN=obx
    '';

  };
}
