{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; gleam2nix.url = "git+https://git.isincredibly.gay/srxl/gleam2nix"; gleam2nix.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { nixpkgs, gleam2nix, ... }: let lib = nixpkgs.lib; supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; forEachSupportedSystem = f: lib.genAttrs supportedSystems (system: f { pkgs = import nixpkgs {inherit system;}; g2n = gleam2nix.packages.${system}.gleam2nix; buildGleamApplication = gleam2nix.lib.${system}.buildGleamApplication; }); in { devShells = forEachSupportedSystem ({ pkgs, g2n, ... }: { default = pkgs.mkShell { packages = with pkgs; [ gleam beamMinimal28Packages.erlang beamMinimal28Packages.rebar3 g2n ]; buildInputs = with pkgs; [ alsa-lib ]; nativeBuildInputs = with pkgs; [ pkg-config ]; }; }); apps = forEachSupportedSystem ({pkgs, ...}: let runtimeInputs = with pkgs; [ gleam beamMinimal28Packages.erlang beamMinimal28Packages.rebar3 beamMinimal28Packages.elixir beamMinimal28Packages.hex ]; in { default = { type = "app"; program = "${(pkgs.writeShellApplication { inherit runtimeInputs; name = "app"; text = '' ${pkgs.gleam}/bin/gleam run ''; })}/bin/app"; }; }); packages = forEachSupportedSystem ({ pkgs, buildGleamApplication, ... }: let buildInputs = with pkgs; [ alsa-lib ]; nativeBuildInputs = with pkgs; [ pkg-config ]; in { default = buildGleamApplication { inherit buildInputs nativeBuildInputs; pname = "fern"; version = "1.0.0"; target = "erlang"; erlang = pkgs.beamMinimal28Packages.erlang; src = ./.; gleamNix = import ./gleam.nix; gleamNixOverrides = final: prev: { alsa = prev.alsa; # .override { # buildInputs = with pkgs; [ # alsa-lib.dev # ]; # }; }; }; }); }; }