A Gleam codegen library in Gleam
1{
2 inputs = {
3 nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
4 };
5
6 outputs = {nixpkgs, ...}: let
7 lib = nixpkgs.lib;
8 supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
9 forEachSupportedSystem = f:
10 lib.genAttrs supportedSystems (system:
11 f {
12 pkgs = import nixpkgs {inherit system;};
13 });
14 in {
15 devShells = forEachSupportedSystem ({pkgs}: {
16 default = pkgs.mkShell {
17 packages = with pkgs; [
18 gleam
19 erlang_28
20 beam28Packages.rebar3
21 ];
22 };
23 });
24 apps = forEachSupportedSystem ({pkgs}: let
25 runtimeInputs = with pkgs; [
26 gleam
27 erlang_28
28 beam28Packages.rebar3
29 ];
30 in {
31 test = {
32 type = "app";
33 program = "${(pkgs.writeShellApplication {
34 inherit runtimeInputs;
35 name = "test";
36 text = ''
37 ${pkgs.gleam}/bin/gleam test
38 '';
39 })}/bin/test";
40 };
41 birdie = {
42 type = "app";
43 program = "${(pkgs.writeShellApplication {
44 inherit runtimeInputs;
45 name = "birdie";
46 text = ''
47 ${pkgs.gleam}/bin/gleam run -m birdie
48 '';
49 })}/bin/birdie";
50 };
51 });
52 };
53}