{
  description = "Local wrapper for Chataigne AppImage";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
  };

  outputs = {
    self,
    nixpkgs,
  }: let
    system = "x86_64-linux";
    pkgs = import nixpkgs {inherit system;};

    # The libraries you requested
    deps = with pkgs; [
      curlFull
      gnutls
      libxrandr
      alsa-lib
      freetype
      avahi
      libglvnd
      curl
      SDL2
      hidapi
      libpulseaudio
      lz4
      openssl
      libcap
      libxcrypt
      libgcrypt
      libbsd
      zlib
      glib
    ];

    # Wrap the local AppImage file
    chataigne-bin = pkgs.appimageTools.wrapType2 {
      pname = "chataigne";
      version = "1.10.3";
      # This points to the file in the same directory as flake.nix
      src = ./Chataigne-linux-x64-1.10.3.AppImage;
      extraPkgs = pkgs: deps;
    };

    # Create the Desktop Entry
    chataigne-desktop = pkgs.makeDesktopItem {
      name = "chataigne";
      exec = "chataigne";
      icon = "chataigne";
      comment = "Modular machine for art and technology";
      desktopName = "Chataigne";
      categories = [
        "AudioVideo"
        "Development"
      ];
    };
  in {
    # packages.${system}.default = chataigne-bin;

    devShells.${system}.default = pkgs.mkShell {
      # Packages you want available in your shell
      buildInputs = [
        chataigne-bin
      ];

      # Environmental variables or shell hooks
      shellHook = ''
        echo "something"
      '';
    };
    # This allows you to run 'nix run' or install it via system config
    packages.${system}.default = pkgs.symlinkJoin {
      name = "chataigne";
      paths = [
        chataigne-bin
        chataigne-desktop
      ];
    };
  };
}
