let
  inputs = import ./deps;
  system = "x86_64-linux";
  pkgs = import inputs.nixpkgs { inherit system; };

  pre-commit-hook = (import inputs."git-hooks.nix").run {
    src = ./.;

    hooks = {
      statix.enable = true;
      deadnix.enable = true;
      rfc101 = {
        enable = true;
        name = "RFC-101 formatting";
        entry = "${pkgs.lib.getExe pkgs.nixfmt-rfc-style}";
        files = "\\.nix$";
      };
      commitizen.enable = true;
    };
  };
in

rec {
  devShells.default = pkgs.mkShell {
    nativeBuildInputs = [ pkgs.bashInteractive ];
    buildInputs = with pkgs; [
      quarto
      texliveFull
      jose
      clevis
      jq
    ];
    shellHook = ''
      ${pre-commit-hook.shellHook}
    '';
  };

  packages.x86_64-linux = {
    website = pkgs.callPackage (
      { stdenv, quarto, ... }:

      stdenv.mkDerivation {
        name = "fosdem24-clevis";
        src = ./.;

        buildInputs = [ quarto ];

        buildPhase = ''
          mkdir _slides
          HOME=. quarto render index.qmd --to revealjs --output-dir _slides 
        '';

        installPhase = ''
          cp -r _slides $out
        '';
      }
    ) { };
  };

  checks.default = {
    inherit packages;
  };
}
