firezone-server: init at unstable-2025-03-15

Co-authored-by: PatrickDaG <patrick@failmail.dev>

oddlama 2fcd77b3 318f0b39

+169
+4
pkgs/by-name/fi/firezone-server-api/package.nix
··· 1 + { firezone-server }: 2 + firezone-server.override { 3 + mixReleaseName = "api"; 4 + }
+4
pkgs/by-name/fi/firezone-server-domain/package.nix
··· 1 + { firezone-server }: 2 + firezone-server.override { 3 + mixReleaseName = "domain"; 4 + }
+4
pkgs/by-name/fi/firezone-server-web/package.nix
··· 1 + { firezone-server }: 2 + firezone-server.override { 3 + mixReleaseName = "web"; 4 + }
+67
pkgs/by-name/fi/firezone-server/0000-add-mua.patch
··· 1 + diff --git a/elixir/apps/domain/lib/domain/config/definitions.ex b/elixir/apps/domain/lib/domain/config/definitions.ex 2 + index 8cd2e8d0f..92e18b10b 100644 3 + --- a/elixir/apps/domain/lib/domain/config/definitions.ex 4 + +++ b/elixir/apps/domain/lib/domain/config/definitions.ex 5 + @@ -584,6 +590,7 @@ defmodule Domain.Config.Definitions do 6 + Swoosh.Adapters.Mailgun, 7 + Swoosh.Adapters.Mailjet, 8 + Swoosh.Adapters.Mandrill, 9 + + Swoosh.Adapters.Mua, 10 + Swoosh.Adapters.Postmark, 11 + Swoosh.Adapters.ProtonBridge, 12 + Swoosh.Adapters.SMTP, 13 + diff --git a/elixir/config/runtime.exs b/elixir/config/runtime.exs 14 + index 15037e0a3..475c4ddfb 100644 15 + --- a/elixir/config/runtime.exs 16 + +++ b/elixir/config/runtime.exs 17 + @@ -226,8 +228,15 @@ if config_env() == :prod do 18 + config :domain, 19 + Domain.Mailer, 20 + [ 21 + - adapter: compile_config!(:outbound_email_adapter), 22 + - from_email: compile_config!(:outbound_email_from) 23 + + adapter: compile_config!(:outbound_email_adapter), 24 + + from_email: compile_config!(:outbound_email_from), 25 + + protocol: String.to_atom(System.get_env("OUTBOUND_EMAIL_SMTP_PROTOCOL")), 26 + + relay: System.get_env("OUTBOUND_EMAIL_SMTP_HOST"), 27 + + port: String.to_integer(System.get_env("OUTBOUND_EMAIL_SMTP_PORT")), 28 + + auth: [ 29 + + username: System.get_env("OUTBOUND_EMAIL_SMTP_USERNAME"), 30 + + password: System.get_env("OUTBOUND_EMAIL_SMTP_PASSWORD") 31 + + ] 32 + ] ++ compile_config!(:outbound_email_adapter_opts) 33 + 34 + config :workos, WorkOS.Client, 35 + diff --git a/elixir/mix.exs b/elixir/mix.exs 36 + index 12782d631..dee1245d2 100644 37 + --- a/elixir/mix.exs 38 + +++ b/elixir/mix.exs 39 + @@ -47,7 +47,9 @@ defmodule Firezone.MixProject do 40 + # Formatter doesn't track dependencies of children applications 41 + {:phoenix, "~> 1.7.0"}, 42 + {:phoenix_live_view, "~> 1.0.0-rc.0"}, 43 + - {:floki, "~> 0.37.0"} 44 + + {:floki, "~> 0.37.0"}, 45 + + {:mua, "~> 0.2.0"}, 46 + + {:mail, "~> 0.3.0"} 47 + ] 48 + end 49 + 50 + diff --git a/elixir/mix.lock b/elixir/mix.lock 51 + index 8c4b65959..3d2f9faca 100644 52 + --- a/elixir/mix.lock 53 + +++ b/elixir/mix.lock 54 + @@ -50,11 +50,13 @@ 55 + "junit_formatter": {:hex, :junit_formatter, "3.4.0", "d0e8db6c34dab6d3c4154c3b46b21540db1109ae709d6cf99ba7e7a2ce4b1ac2", [:mix], [], "hexpm", "bb36e2ae83f1ced6ab931c4ce51dd3dbef1ef61bb4932412e173b0cfa259dacd"}, 56 + "libcluster": {:hex, :libcluster, "3.3.3", "a4f17721a19004cfc4467268e17cff8b1f951befe428975dd4f6f7b84d927fe0", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "7c0a2275a0bb83c07acd17dab3c3bfb4897b145106750eeccc62d302e3bdfee5"}, 57 + "logger_json": {:hex, :logger_json, "6.2.0", "13e2e9f5f7b195865c5c3ef3d296c3ad50e7ecb038d899433702a79e979b91d7", [:mix], [{:ecto, "~> 3.11", [hex: :ecto, repo: "hexpm", optional: true]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: true]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "98366d02bedbb56e41b25a6d248d566d4f4bc224bae2b1e982df00ed04ba9219"}, 58 + + "mail": {:hex, :mail, "0.3.1", "cb0a14e4ed8904e4e5a08214e686ccf6f9099346885db17d8c309381f865cc5c", [:mix], [], "hexpm", "1db701e89865c1d5fa296b2b57b1cd587587cca8d8a1a22892b35ef5a8e352a6"}, 59 + "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, 60 + "mime": {:hex, :mime, "2.0.6", "8f18486773d9b15f95f4f4f1e39b710045fa1de891fada4516559967276e4dc2", [:mix], [], "hexpm", "c9945363a6b26d747389aac3643f8e0e09d30499a138ad64fe8fd1d13d9b153e"}, 61 + "mimerl": {:hex, :mimerl, "1.3.0", "d0cd9fc04b9061f82490f6581e0128379830e78535e017f7780f37fea7545726", [:rebar3], [], "hexpm", "a1e15a50d1887217de95f0b9b0793e32853f7c258a5cd227650889b38839fe9d"}, 62 + "mint": {:hex, :mint, "1.6.2", "af6d97a4051eee4f05b5500671d47c3a67dac7386045d87a904126fd4bbcea2e", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1 or ~> 0.2.0 or ~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "5ee441dffc1892f1ae59127f74afe8fd82fda6587794278d924e4d90ea3d63f9"}, 63 + "mix_audit": {:hex, :mix_audit, "2.1.4", "0a23d5b07350cdd69001c13882a4f5fb9f90fbd4cbf2ebc190a2ee0d187ea3e9", [:make, :mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:yaml_elixir, "~> 2.11", [hex: :yaml_elixir, repo: "hexpm", optional: false]}], "hexpm", "fd807653cc8c1cada2911129c7eb9e985e3cc76ebf26f4dd628bb25bbcaa7099"}, 64 + + "mua": {:hex, :mua, "0.2.4", "a9172ab0a1ac8732cf2699d739ceac3febcb9b4ffc540260ad2e32c0b6632af9", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "e7e4dacd5ad65f13e3542772e74a159c00bd2d5579e729e9bb72d2c73a266fb7"}, 65 + "multipart": {:hex, :multipart, "0.4.0", "634880a2148d4555d050963373d0e3bbb44a55b2badd87fa8623166172e9cda0", [:mix], [{:mime, "~> 1.2 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm", "3c5604bc2fb17b3137e5d2abdf5dacc2647e60c5cc6634b102cf1aef75a06f0a"}, 66 + "nimble_csv": {:hex, :nimble_csv, "1.2.0", "4e26385d260c61eba9d4412c71cea34421f296d5353f914afe3f2e71cce97722", [:mix], [], "hexpm", "d0628117fcc2148178b034044c55359b26966c6eaa8e2ce15777be3bbc91b12a"}, 67 + "nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"},
+90
pkgs/by-name/fi/firezone-server/package.nix
··· 1 + { 2 + lib, 3 + nixosTests, 4 + fetchFromGitHub, 5 + beamPackages, 6 + gitMinimal, 7 + pnpm_9, 8 + nodejs, 9 + tailwindcss_3, 10 + esbuild, 11 + 12 + mixReleaseName ? "domain", # "domain" "web" or "api" 13 + }: 14 + 15 + beamPackages.mixRelease rec { 16 + pname = "firezone-server-${mixReleaseName}"; 17 + version = "0-unstable-2025-03-15"; 18 + 19 + src = "${ 20 + fetchFromGitHub { 21 + owner = "firezone"; 22 + repo = "firezone"; 23 + rev = "09fb5f927410503b0d6e7fc6cf6a2ba06cb5a281"; 24 + hash = "sha256-1CZBFhOwX0DfXykPQ9tzn4tHg2tSnByXEPtlZleHK5k="; 25 + 26 + # This is necessary to allow sending mails via SMTP, as the default 27 + # SMTP adapter is current broken: https://github.com/swoosh/swoosh/issues/785 28 + postFetch = '' 29 + ${lib.getExe gitMinimal} -C $out apply ${./0000-add-mua.patch} 30 + ''; 31 + } 32 + }/elixir"; 33 + 34 + pnpmDeps = pnpm_9.fetchDeps { 35 + inherit pname version; 36 + src = "${src}/apps/web/assets"; 37 + hash = "sha256-ejyBppFtKeyVhAWmssglbpLleOnbw9d4B+iM5Vtx47A="; 38 + }; 39 + pnpmRoot = "apps/web/assets"; 40 + 41 + preBuild = '' 42 + cat >> config/config.exs <<EOF 43 + config :tailwind, path: "${lib.getExe tailwindcss_3}" 44 + config :esbuild, path: "${lib.getExe esbuild}" 45 + EOF 46 + 47 + cat >> config/runtime.exs <<EOF 48 + config :tzdata, :data_dir, System.fetch_env!("TZDATA_DIR") 49 + EOF 50 + ''; 51 + 52 + postBuild = '' 53 + pushd apps/web 54 + # for external task you need a workaround for the no deps check flag 55 + # https://github.com/phoenixframework/phoenix/issues/2690 56 + mix do deps.loadpaths --no-deps-check, assets.deploy 57 + mix do deps.loadpaths --no-deps-check, phx.digest priv/static 58 + popd 59 + ''; 60 + 61 + nativeBuildInputs = [ 62 + pnpm_9 63 + pnpm_9.configHook 64 + nodejs 65 + ]; 66 + 67 + inherit mixReleaseName; 68 + 69 + mixFodDeps = beamPackages.fetchMixDeps { 70 + pname = "mix-deps-${pname}-${version}"; 71 + inherit src version; 72 + hash = "sha256-2Y9u5+o8+RG+c8Z6V7Vex5K1odI7a/WYj5fC0xWbVRo="; 73 + }; 74 + 75 + passthru.tests = { 76 + inherit (nixosTests) firezone; 77 + }; 78 + 79 + meta = { 80 + description = "Backend server for the Firezone zero-trust access platform"; 81 + homepage = "https://github.com/firezone/firezone"; 82 + license = lib.licenses.elastic20; 83 + maintainers = with lib.maintainers; [ 84 + oddlama 85 + patrickdag 86 + ]; 87 + mainProgram = mixReleaseName; 88 + platforms = lib.platforms.linux; 89 + }; 90 + }