{
  inputs = {
    nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
    flake-utils.url = github:numtide/flake-utils;
  };

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
      in rec {
      packages = rec {
        # Just the contents of src/main/webapp
        webRoot = pkgs.stdenv.mkDerivation {
          name = "drawio-msdl";
          src = ./src/main/webapp;
          installPhase = ''
            mkdir -p $out/share
            cp -r $src/* $out/share
          '';
        };
        # Absolute minimal web server serving 'webRoot'
        staticServer = let
          lighttpConfig = pkgs.writeTextFile {
            name = "lighttpd.conf";
            text = ''
              server.document-root = "${webRoot}/share"
              server.port = 8700
              server.upload-dirs = ( "/tmp" )
              index-file.names = ( "index.html" )
              mimetype.assign = (
                ".html" => "text/html", 
                ".txt" => "text/plain",
                ".xml" => "text/xml",
                ".css" => "text/css",
                ".jpg" => "image/jpeg",
                ".png" => "image/png",
                ".webp" => "image/webp",
                ".svg" => "image/svg+xml",
                ".js" => "application/javascript",
              )
            '';
          };
          script = pkgs.writeShellScript "drawio-msdl-staticserver.sh" ''
            exec ${pkgs.lighttpd}/bin/lighttpd -f ${lighttpConfig} -D
          '';
        in pkgs.stdenv.mkDerivation {
          name = "drawio-msdl-staticserver";
          src = ./src/main/webapp;
          buildInputs = [ pkgs.lighttpd ];
          installPhase = ''
            mkdir -p $out/bin
            ln -s ${script} $out/bin/drawio-msdl-staticserver
          '';
        };
      };
      defaultPackage = packages.webRoot;

      apps = rec {
        # App that starts when invoking `nix run .#serviceMonitor`
        staticServer = {
          type = "app";
          program = "${self.packages.${system}.staticServer}/bin/drawio-msdl-staticserver";
        };

        # App that starts when invoking `nix run .`
        default = staticServer;
      };
    });

  nixConfig.bash-prompt-prefix = "\\e\[94;1m[drawio]\\e\[m ";
}