{
  lib,
  stdenv,
  fetchFromGitHub,
  typescript,
  nodejs,
  bash,
}:
stdenv.mkDerivation rec {
  pname = "karousel";
  version = "0.10";

  src = fetchFromGitHub {
    owner = "peterfajdiga";
    repo = "karousel";
    rev = "v${version}";
    hash = "sha256-lI3VaCd4eYhWbnYLEIeFiB88SWjd/DF8CUGFmxEXDXo=";
  };

  nativeBuildInputs = [
    typescript
    nodejs
    bash
  ];

  dontConfigure = true;
  dontBuild = true;

  # Run the simple commands that generate the plugin.
  installPhase = ''
    mkdir -p $out/contents/code $out/contents/config

    # Build the parts that need to be built...
    tsc -p ./src/main --outFile $out/contents/code/main.js
    bash ./run-ts.sh ./src/generators/config > $out/contents/config/main.xml

    # ... and copy the rest.
    cp -r $src/package/* $out/
  '';

  meta = {
    description = "Scrollable tiling Kwin script";
    homepage = "https://github.com/peterfajdiga/karousel/releases/download/v0.10/karousel_0_10.tar.gz";
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [ ];
    mainProgram = "karousel";
    platforms = lib.platforms.all;
  };
}
