Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wzJQ3-003wS2-1Q for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Aug 2026 19:36:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wzJQ1-00FRLM-0m for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Aug 2026 19:36:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wzJQ0-00FRLE-28 for pgsql-hackers@lists.postgresql.org; Wed, 26 Aug 2026 19:36:16 +0000 Received: from fout-b6-smtp.messagingengine.com ([202.12.124.149]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wzJPx-00000001QIy-3PdS for pgsql-hackers@lists.postgresql.org; Wed, 26 Aug 2026 19:36:16 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id D31EB1D0010B; Wed, 26 Aug 2026 15:36:10 -0400 (EDT) Received: from phl-imap-15 ([10.202.2.104]) by phl-compute-05.internal (MEProxy); Wed, 26 Aug 2026 15:36:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=partin.io; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1787772970; x=1787859370; bh=eL/ysOMqiU4ccSUNj0ePoURebsHs10qpmTKyYLWlL4g=; b= o1YlB3M3F19WB1GfeVl1TD0xgkVDIFNjjCtW4p7pOg6AVa2i+Qv459/82xoUnBEu NnD+UjhI4RZ4NaIj8+3Z9+x/Xvoz77wo8K89kwhddnwhG/yIv90o7TnpZajez7Mj ebAX7f5gQ5eElNn+NAyRSVHl9T8cbm0pzHn+Xr/WVnAUdhhErhtOF6kPhRdPs2Lb TvfUFQxbU3pT8a/El0qsgJOd99UmWFsMmwawP9UOSEP2bN0CpGh8zkwBFkSarA9x MJ9fi5I1F28O9AXFnyYWidmLJgTMdgEJtKBMiWsAnym5eaX4EBlq14E/hZFclcum 8R5clSXdkW/IcS9ljL1pWg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1787772970; x= 1787859370; bh=eL/ysOMqiU4ccSUNj0ePoURebsHs10qpmTKyYLWlL4g=; b=h QR4arfP7/5z2FpQgw+C3Zb3RYXOdVW/gH/9I/aepLIAiBVFmJj7NKFU8DBaAc9mT EoiYc4QxPvhfPNEpxsgmmk09FfZDG7xmqJm1IDHfWZX54pBkMS15UMBeNZPDh24x /MB6kUwoP0fAetqSE+zCj9TkKc+YAYOkhQem1r0ii4+D6YSjRxOvPKPcGua4t4Gz uIgsNYI/d4ofaXpyzWg2fJRWx/YUgtptou4rTgLEavWiBYlMs42WEBB8OGeVKnrh /ubTm7JmvHw3hOVL0KihovZhRlxru252rbwXd+c0/+5K8qWnebM9forTiIe1gRO1 DpHk6LUof070LVZSKZs+w== X-ME-Sender: X-ME-Proxy-Cause: dmFkZTE7wItBUAlb0wx7qVO/7QPquWb+Fv0G1gZ93RQiQt6ft26G529eLNF9tdhQXZuzU2 EaK6Xq0y6DuNXTRdgHHqx3FFbabESh8FqWZL44lkzCcfH+/KItJAlpwXr6XAKwYViyQ0c6 Xz9a7qGFlXnmv3KeezoEsYCd0H1Ek8U2XMmhQz6cFM+O8b8IHfzqTKNPscV89HypLnbF43 6vaLMFIuRJrVw9qn/6M6fGHTV0PzYA28BAWObeoAWD3uaFIYEYipS9UX8NbprtFZYGL2qz gQqIGhsHtcpUQg2FYvb/fjG3prIU3GbKyoc2Ca3vmHNTcDhPykoD5tmWVHpcmjU07+5Isf 3U4A595TWDsiY0ouqbK2d9NnQxmlZH7ZKBAyTNH2V4joG8e4k0xYYOLXrzIgdiraY9cdY7 AqDTYjLvJTyoG7nz8oN+ne3pss2NRfj/USjf8lQ0BMdzkOhTnwRpAdUs6na2Tq4i5ctREq qVyhfcFnqe1bXNVr4tlqDRibyiYQywidONMIwy/AdNhJzlCfJC+UGgfiZEMmib6JkUMHYI jIjmj0lxzYORdbKl3UzPkwDuk6GRK0308p+vLvl10Cx+dtg7QKymsrmJQ2Yne+xRzQMUkG Eavuq6iAYb8gX5d+lfCFW927+lD5kQUzcAKygDo3ERxcfhyczcRtUMYj0jUg X-ME-Proxy: Feedback-ID: idd01497b:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 6CD957811F3; Wed, 26 Aug 2026 15:36:10 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 26 Aug 2026 19:36:10 +0000 Message-Id: Cc: "PostgreSQL Hackers" Subject: Re: Add a Nix flake To: "Greg Burd" From: "Tristan Partin" X-Mailer: aerc 0.22.0-10-g2b907edf1807 References: <7ee22a5d-3776-49d5-8309-98097ffb88b1@app.fastmail.com> In-Reply-To: <7ee22a5d-3776-49d5-8309-98097ffb88b1@app.fastmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue Aug 25, 2026 at 9:50 AM UTC, Greg Burd wrote: > On Mon Aug 24, 2026 at 2:39 PM CDT, Tristan Partin wrote: >> +1 > > Thanks Tristan, glad to have another Nix user weigh in. > >>> A single blessed flake in the tree gives everyone the same reproducible >>> starting point [...] >> >> I am one of the people that has a private copy. I've also been working >> on a NixOS-based buildfarm client that includes a derivation for the >> buildfarm-client code. > > That's cool, let's make sure this and that somehow knit up into something > useful. Do you want to share it on this thread or start another one? I think it is probably best not to muddy up the thread. I can announce=20 the thing when it is ready to share publicly, probably after PGConf.EU.=20 I think it could be a game changer for allocating and maintaining=20 buildfarm clients. Eventually it might help bolster your effort in this=20 thread. >>> One deliberate omission: there is no flake.lock. >> >> I think the lack of flake.lock makes sense. I would add it to the >> .gitignore. Additionally, I would also add `/result` and `/result-*` to >> the .gitignore. > > Done. Added a small "Nix (see flake.nix)" block to the root .gitignore > covering /flake.lock, /result, and /result-*. Root-anchored so we don't > accidentally ignore a result/ somewhere in the tree. > >>> To use it you'll need to be in a Nix environment. This means a Nix-base= d >>> OS like NixOS or the macOS/Windows layers [...] >> >> Can be Linux as well! For instance, I am using Nix on Fedora, which is >> available in the Fedora system repositories. > > Good correction, you're right, and it's an important one. Nix runs anywhe= re > the package manager is installed; it doesn't require NixOS. I'll fix that > wording in the commit-message/docs framing rather than the code, since th= e > flake itself is already OS-agnostic and useful in all these locations. A= s > it happens I use Nix on Fedora on one host, Nix on BSD on another, NixOS > on a separate host and I'm also working to Nix-ify Illumos [1]. > >>> Flip any single feature (26 toggles) without a preset: >>> nix build --expr '(builtins.getFlake (toString ./.)).packages...' >> >> I didn't know that this was a thing. What a mouthful! > > Agreed, it is. It's the escape hatch, not the ergonomic path, most people > will want a preset or their own thin wrapper flake with `.override { ... = }`. > I included it only to show the full toggle surface is reachable without > editing the file. > > I'm also sure there are ways to add simplified common config into the fla= ke > but I was starting off with something very bland/effective and hopefully > not overly opinionated to gain buy-in. > >> I think this will also have side benefits of making things easier to >> test. For instance, we could start inlining buildfarm client members >> configurations as derivations in this repository. [...] Additionally, I >> wonder if NixOS VM tests could expose new ways to do automated testing o= f >> Postgres. > > Both are appealing, and I think they're the real long-term payoff, a > derivation library of animal configs under version control, and NixOS VM > tests for things that are painful to exercise otherwise (replication > topologies, systemd integration, upgrade paths). I'd like to keep v1 to j= ust > the flake so it's easy to review and agree on, then build those out as > separate patches on top. Happy to collaborate! More just throwing ideas into the ether of what this could enable.=20 Definitely not recommending it for a v1, but given the discussion in the=20 other subthread, maybe showing an example of what we could do in a NixOS=20 VM test that we currently don't do in our current setup could be=20 appealing to show people a benefit. >> Regarding the code, can you explain the reasoning for the packages list >> in the development shell? It seems like everything in the list is >> already included by the Postgres package. > > You're right, and thank you, that list was mostly redundant. `inputsFrom = =3D > [ postgresql ]` already pulls in the package's nativeBuildInputs and > buildInputs, so meson, ninja, bison, flex, perl, python3, tcl, and libxsl= t > were all being listed twice. I've trimmed the devShell down to only what = the > package does *not* provide: > > - ccache (a dev convenience, not a build input), and > - docbook_xml_dtd_45 + docbook-xsl-nons (the DocBook toolchain, since d= ocs > are off in the default package build, so `nix develop` can build docs > without a separate override). > > Verified the trimmed shell still exposes meson/ninja/perl/python3/tcl/lib= xslt > via inputsFrom, so nothing was actually lost. Will include that in v2. For what it's worth, the docs targets on Meson, at least, are not built=20 by default, so adding enabling the docs feature by default seems fine to=20 me. Then it would just be ccache left in the devShell. > Thanks again for the careful read. --=20 Tristan Partin PostgreSQL Contributors Team AWS (https://aws.amazon.com)