{
  description = "Simple OpenGL dev/build flake";

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

  outputs = { self, nixpkgs }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs { inherit system; };
    in
    {
      devShells.${system}.default = pkgs.mkShell {
        buildInputs = with pkgs; [
          gcc
          glfw
          glew
        ];

        shellHook = ''
          echo "Run:"
          echo 'g++ shader.cpp -o test -lglfw -lGLEW -lGL && ./test'
        '';
      };

      packages.${system}.default = pkgs.stdenv.mkDerivation {
        pname = "shader";
        version = "0.1";

        src = ./.;

        buildInputs = with pkgs; [
          glfw
          glew
        ];

        nativeBuildInputs = with pkgs; [
          gcc
        ];

        buildPhase = ''
          g++ shader.cpp -o shader -lglfw -lGLEW -lGL
        '';

        installPhase = ''
          mkdir -p $out/bin
          cp shader $out/bin/
        '';
      };

      apps.${system}.default = {
        type = "app";
        program = "${self.packages.${system}.default}/bin/shader";
      };
    };
}
