{
  description = "3DS Homebrew dev environment";

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

  outputs = { self, nixpkgs, flake-utils, devkitNix, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs {
          inherit system;
          overlays = [ devkitNix.overlays.default ];
        };
      in {
        devShells.default = pkgs.mkShell.override { stdenv = pkgs.devkitNix.stdenvARM; } {
          nativeBuildInputs = [
            pkgs.gnumake
          ];
            shellHook = ''
              export PATH="${pkgs.bear}/bin:${pkgs.azahar}/bin:$PATH"
            '';
        };

        packages.default = pkgs.stdenv.mkDerivation {
          name = "3DS-app";
          src  = ./.;
          makeFlags = [ "TARGET=3DS-app" ];
          installPhase = ''
            mkdir $out 
            cp 3DS-app.3dsx $out/
          '';
        };
      }
    );
}
