Vincent Bernat: Customize Caddy's plugins with Nix
dial tcp: lookup proxy.golang.org on [::1]:53:
connection refused.
pkgs : pkgs.stdenv.mkDerivation name = "caddy-with-xcaddy"; nativeBuildInputs = with pkgs; [ go xcaddy cacert ]; unpackPhase = "true"; buildPhase = '' xcaddy build --with github.com/caddy-dns/powerdns@v1.0.1 ''; installPhase = '' mkdir -p $out/bin cp caddy $out/bin '';
fetchurl function produces a fixed-output derivation:
stdenv, fetchurl : stdenv.mkDerivation rec pname = "hello"; version = "2.12.1"; src = fetchurl url = "mirror://gnu/hello/hello-$ version .tar.gz"; hash = "sha256-jZkUKv2SV28wsM18tCqNxoCZmLxdYH2Idh9RLibH2yA="; ;
outputHash
attribute. The example below shows how to output Caddy s source
code, with some plugin enabled, as a fixed-output derivation using xcaddy and
go mod vendor.
pkgs.stdenvNoCC.mkDerivation rec pname = "caddy-src-with-xcaddy"; version = "2.8.4"; nativeBuildInputs = with pkgs; [ go xcaddy cacert ]; unpackPhase = "true"; buildPhase = '' export GOCACHE=$TMPDIR/go-cache export GOPATH="$TMPDIR/go" XCADDY_SKIP_BUILD=1 TMPDIR="$PWD" \ xcaddy build v$ version --with github.com/caddy-dns/powerdns@v1.0.1 (cd buildenv* && go mod vendor) ''; installPhase = '' mv buildenv* $out ''; outputHash = "sha256-F/jqR4iEsklJFycTjSaW8B/V3iTGqqGOzwYBUXxRKrc="; outputHashAlgo = "sha256"; outputHashMode = "recursive";
- we ask
xcaddyto not compile the program and keep the source code,3 - we pin the version of Caddy we want to build, and
- we pin the version of each requested plugin.
src attribute in pkgs.caddy:
pkgs.caddy.overrideAttrs (prev: src = pkgs.stdenvNoCC.mkDerivation /* ... */ ; vendorHash = null; subPackages = [ "." ]; );
github:vincentbernat/caddy-nix as an overlay:
inputs = nixpkgs.url = "nixpkgs"; flake-utils.url = "github:numtide/flake-utils"; caddy.url = "github:vincentbernat/caddy-nix"; ; outputs = self, nixpkgs, flake-utils, caddy : flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs inherit system; overlays = [ caddy.overlays.default ]; ; in packages = default = pkgs.caddy.withPlugins plugins = [ "github.com/caddy-dns/powerdns@v1.0.1" ]; hash = "sha256-F/jqR4iEsklJFycTjSaW8B/V3iTGqqGOzwYBUXxRKrc="; ; ; );
Update (2024-11)
This flake won t work with Nixpkgs 24.05 or older because
it relies on this
commit
to properly override the vendorHash attribute.
- This article uses the term plugins, though Caddy documentation also refers to them as modules since they are implemented as Go modules.
- This is a feature request since quite some time. A proposed solution has been rejected. The one described in this article is a bit different and I have proposed it in another pull request.
-
This is not perfect: if the source code produced by
xcaddychanges, the hash would change and the build would fail.
A new release of the 










I was interested in learning about 

The topic of this posting already tells you that an old Unix guy tells
stories about old techniques.
I'm a happy NIS (formerly YP) user since 30+ years. I started using it
with SunOS 4.0, later using it with Solaris and with Linux since 1999.
In the past, a colleague wasn't happyly using NIS+ when he couldn't
log in as root after a short time because of some well known bugs and wrong
configs. NIS+ was also much slower than my NIS setup. I know
organisations using NIS for more than 80.000 user accounts in 2024.
I know the security implications of NIS but I can live with them,
because I manage all computers in the network that have access to the
NIS maps. And NIS on Linux offers to use shadow maps, which are only
accessible to the root account. My users are forced to use very
long passwords.
Unfortunately NIS support for the PAM modules was removed in Debian
in pam 1.4.0-13, which means Debian 12 (bookworm) is
lacking NIS support in PAM, but otherwise it is still supported.
This only affects changing the NIS password via passwd. You can still
authenticate users and use other NIS maps.
But

Dear Debian community,
this is Bits from DPL for October. In addition to a summary of my
recent activities, I aim to include newsworthy developments within
Debian that might be of interest to the broader community. I believe
this provides valuable insights and foster a sense of connection across
our diverse projects. Also, I welcome your feedback on the format and
focus of these Bits, as community input helps shape their value.
Ada Lovelace Day 2024
As outlined in my platform, I'm committed to increasing the diversity of
Debian developers. I hope the recent article celebrating Ada Lovelace
Day 2024 featuring interviews with
The coffee shop Ibtehal and me used to visit during the midnight
Grating at a chemist shop in Mombasa, Kenya
Me with players at the Nairobi Gymkhana Club
Cricket pitch at the Nairobi Gymkhana Club
A view of the cricket ground inside the Nairobi Gymkhana Club
Scoreboard at the Nairobi Gymkhana cricket ground
A matatu with a Notorious BIG portrait.
Inside the Giraffe Center
SGR train at Nairobi Terminus.
Interior of the SGR train
Mombasa Terminus station.
The balcony at Tulia Backpackers Hostel had a nice view of the ocean.
A room inside the hostel with fans and mosquito nets on the beds
Nyali beach is a white sand beach
This is the ferry service for crossing the river.
Diani beach is a popular beach in Kenya. It is a white sand beach.
Selfie with truck drivers who gave me the free ride
Newspapers at a stand in Kenya covering news on the airport closure
Spanish Omelette served in breakfast at Nairobi Transit Hotel
Ugali with eggs.
Another short status update of what happened on my side last month. Besides a
Doing more swimming in everyday life for the past few months. Seems like I am keeping that up.
A hot-fix release 1.0.13-1, consisting of two small PRs relative to
the last regular
Almost all of my Debian contributions this month were