nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 nixosTests,
4 fetchFromGitHub,
5 beam27Packages,
6 gitMinimal,
7 pnpm_9,
8 fetchPnpmDeps,
9 pnpmConfigHook,
10 nodejs,
11 tailwindcss_3,
12 esbuild,
13
14 mixReleaseName ? "domain", # "domain" "web" or "api"
15}:
16beam27Packages.mixRelease rec {
17 pname = "firezone-server-${mixReleaseName}";
18 version = "0-unstable-2025-08-31";
19
20 src = "${
21 fetchFromGitHub {
22 owner = "firezone";
23 repo = "firezone";
24 rev = "f86719db19b848ab757995361032c1f2b7927d13";
25 hash = "sha256-MrW+mnVMi3mOwkcWDsY84rVBaX1qJPmqkecdH8I2ng0=";
26
27 # This is necessary to allow sending mails via SMTP, as the default
28 # SMTP adapter is current broken: https://github.com/swoosh/swoosh/issues/785
29 postFetch = ''
30 ${lib.getExe gitMinimal} -C $out apply ${./0000-add-mua.patch}
31 '';
32 }
33 }/elixir";
34
35 pnpmDeps = fetchPnpmDeps {
36 inherit pname version;
37 pnpm = pnpm_9;
38 src = "${src}/apps/web/assets";
39 fetcherVersion = 1;
40 hash = "sha256-40vtQIBhJNnzdxkAOVAcPN57IuD0IB6LFxGICo68AbQ=";
41 };
42 pnpmRoot = "apps/web/assets";
43
44 preBuild = ''
45 cat >> config/config.exs <<EOF
46 config :tailwind, path: "${lib.getExe tailwindcss_3}"
47 config :esbuild, path: "${lib.getExe esbuild}"
48 EOF
49
50 cat >> config/runtime.exs <<EOF
51 config :tzdata, :data_dir, System.fetch_env!("TZDATA_DIR")
52 EOF
53 '';
54
55 postBuild = ''
56 pushd apps/web
57 # for external task you need a workaround for the no deps check flag
58 # https://github.com/phoenixframework/phoenix/issues/2690
59 mix do deps.loadpaths --no-deps-check, assets.deploy
60 mix do deps.loadpaths --no-deps-check, phx.digest priv/static
61 popd
62 '';
63
64 nativeBuildInputs = [
65 pnpmConfigHook
66 pnpm_9
67 nodejs
68 ];
69
70 inherit mixReleaseName;
71
72 mixFodDeps = beam27Packages.fetchMixDeps {
73 pname = "mix-deps-${pname}-${version}";
74 inherit src version;
75 hash = "sha256-h3l7HK9dxNmkHWfJyCOCXmCvFOK+mZtmszhRv0zxqoo=";
76 };
77
78 passthru.tests = {
79 inherit (nixosTests) firezone;
80 };
81
82 meta = {
83 description = "Backend server for the Firezone zero-trust access platform";
84 homepage = "https://github.com/firezone/firezone";
85 license = lib.licenses.elastic20;
86 maintainers = with lib.maintainers; [
87 oddlama
88 patrickdag
89 ];
90 mainProgram = mixReleaseName;
91 platforms = lib.platforms.linux;
92 };
93}