tools for building gleam projects with nix

gleam-tool: support application_start_argument in gleam.toml for app spec generation

foxgirl.engineering 9aae0989 ec4f21e3

verified
+15 -2
+4
CHANGELOG.md
··· 10 11 ## unreleased 12 13 ### changed 14 15 - added default meta attributes to `buildGleamApplication` derivations
··· 10 11 ## unreleased 12 13 + ### added 14 + 15 + - support for the new `erlang.application_start_argument` option in `gleam.toml`, introduced in gleam `1.13.0-rc1` 16 + 17 ### changed 18 19 - added default meta attributes to `buildGleamApplication` derivations
+10 -2
gleam_tool/src/app.rs
··· 54 55 let applications = get_applications(otp_dependencies, &gleam_toml).join(","); 56 let modules = get_modules(out_dir)?.join(","); 57 let start_module = gleam_toml 58 .erlang 59 - .and_then(|e| e.application_start_module) 60 - .map(|module| format!("{{mod, {{'{module}', []}}}},\n")) 61 .unwrap_or_default(); 62 63 Ok(AppSpec {
··· 54 55 let applications = get_applications(otp_dependencies, &gleam_toml).join(","); 56 let modules = get_modules(out_dir)?.join(","); 57 + 58 let start_module = gleam_toml 59 .erlang 60 + .and_then(|e| { 61 + e.application_start_module.map(|module| { 62 + ( 63 + module, 64 + e.application_start_argument.unwrap_or("[]".to_string()), 65 + ) 66 + }) 67 + }) 68 + .map(|(module, args)| format!("{{mod, {{'{module}', {args}}}}},\n")) 69 .unwrap_or_default(); 70 71 Ok(AppSpec {
+1
gleam_tool/src/gleam_toml.rs
··· 10 #[derive(Facet)] 11 pub struct ErlangOptions { 12 pub application_start_module: Option<String>, 13 pub extra_applications: Option<Vec<String>>, 14 } 15
··· 10 #[derive(Facet)] 11 pub struct ErlangOptions { 12 pub application_start_module: Option<String>, 13 + pub application_start_argument: Option<String>, 14 pub extra_applications: Option<Vec<String>>, 15 } 16