Change:
Caddy fails to build for riscv64 Steps to reproduce the behavior: ... ... ... A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. Add any other context about the problem here. <!-- Please @ people who are in the list of the offending package or module. If in doubt, check for whoever last touched something. --Please run and paste the result. Add a :+1: [reaction] to [issues you find important]. [reaction]: [issues you find important]:
(please fill out more parts of the bug report template next time) Assuming this is , likely an instance of . Pinging maintainers:
Hi, thanks for the ping :) The fix for this is fairly trivial. Either skip the shell completions/man pages[^1], or use something like But I am upset that you ( didn't even care enough to do the bare minimum and fill out the issue template. [^1]: Technically only the kills the build, not the , because bash pipefail defaults.
i'm sorry for the issue template, it was more of a quick note to myself. i'll do it right next time

Discussion:
<ins> { lib , buildGoModule , fetchFromGitHub , nixosTests , caddy , testers , installShellFiles , stdenv }: let version = "2.7.6"; dist = fetchFromGitHub { owner = "caddyserver"; repo = "dist"; rev = "v${version}"; hash = "sha256-aZ7hdAZJH1PvrX9GQLzLquzzZG3LZSKOvt7sWQhTiR8="; }; in buildGoModule { pname = "caddy"; inherit version; src = fetchFromGitHub { owner = "caddyserver"; repo = "caddy"; rev = "v${version}"; hash = "sha256-th0R3Q1nGT0q5PGOygtD1/CpJmrT5TYagrwQR4t/Fvg="; }; vendorHash = "sha256-ebnSehuhbCY58ctM8IRVMfNxxbJBp6ht9cbuLdGFNek="; subPackages = [ "cmd/caddy" ]; ldflags = [ "-s" "-w" "-X github.com/caddyserver/caddy/v2.CustomVersion=${version}" ]; nativeBuildInputs = [ installShellFiles ]; postInstall = '' install -Dm644 ${dist}/init/caddy.service ${dist}/init/caddy-api.service -t $out/lib/systemd/system substituteInPlace $out/lib/systemd/system/caddy.service  --replace-fail "/usr/bin/caddy" "$out/bin/caddy" substituteInPlace $out/lib/systemd/system/caddy-api.service  --replace-fail "/usr/bin/caddy" "$out/bin/caddy" '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' # Generating man pages and completions fail on cross-compilation # https://github.com/NixOS/nixpkgs/issues/308283 $out/bin/caddy manpage --directory manpages installManPage manpages/* installShellCompletion --cmd caddy  --bash <($out/bin/caddy completion bash)  --fish <($out/bin/caddy completion fish)  --zsh <($out/bin/caddy completion zsh) ''; passthru.tests = { inherit (nixosTests) caddy; version = testers.testVersion { command = "${caddy}/bin/caddy version"; package = caddy; }; }; meta = with lib; { homepage = "https://caddyserver.com"; description = "Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS"; license = licenses.asl20; mainProgram = "caddy"; maintainers = with maintainers; [ Br1ght0ne emilylange techknowlogick ]; }; } </ins>

<ins> diff --git a/cmd/main.go b/cmd/main.go index ede7cd8..c553140 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -401,8 +401,11 @@ func splitWith(arg string) (module, version, replace string, err error) { return } +var customVersion string + // xcaddyVersion returns a detailed version string, if available. func xcaddyVersion() string { +	return customVersion mod := goModule() ver := mod.Version if mod.Sum != "" { </ins>

<ins> { lib, buildGoModule, fetchFromGitHub }: buildGoModule rec { pname = "xcaddy"; version = "0.4.1"; subPackages = [ "cmd/xcaddy" ]; src = fetchFromGitHub { owner = "caddyserver"; repo = pname; rev = "v${version}"; hash = "sha256-xEPSRKrQC9hb+G9/rV9/k4btvZxXZkcsxmaxWcgl2fk="; }; patches = [ ./inject_version_info.diff ./use_tmpdir_on_darwin.diff ]; ldflags = [ "-s" "-w" "-X github.com/caddyserver/xcaddy/cmd.customVersion=v${version}" ]; vendorHash = "sha256-7yd/6h1DKw7X/1NbHtr2vbpyapF81HPmDm7O4oV5nlc="; meta = with lib; { homepage = "https://github.com/caddyserver/xcaddy"; description = "Build Caddy with plugins"; mainProgram = "xcaddy"; license = licenses.asl20; maintainers = with maintainers; [ tjni emilylange ]; }; } </ins>

<ins> diff --git a/builder.go b/builder.go index ed6c5ef..36e8055 100644 --- a/builder.go +++ b/builder.go @@ -200,7 +200,7 @@ func NewReplace(old, new string) Replace { // It is the caller's responsibility to remove the folder when finished. func newTempFolder() (string, error) { var parentDir string -	if runtime.GOOS == "darwin" { +	if false && runtime.GOOS == "darwin" { // After upgrading to macOS High Sierra, Caddy builds mysteriously // started missing the embedded version information that -ldflags // was supposed to produce. But it only happened on macOS after </ins>

<del> { lib , buildGoModule , fetchFromGitHub , nixosTests , caddy , testers , installShellFiles }: let version = "2.7.6"; dist = fetchFromGitHub { owner = "caddyserver"; repo = "dist"; rev = "v${version}"; hash = "sha256-aZ7hdAZJH1PvrX9GQLzLquzzZG3LZSKOvt7sWQhTiR8="; }; in buildGoModule { pname = "caddy"; inherit version; src = fetchFromGitHub { owner = "caddyserver"; repo = "caddy"; rev = "v${version}"; hash = "sha256-th0R3Q1nGT0q5PGOygtD1/CpJmrT5TYagrwQR4t/Fvg="; }; vendorHash = "sha256-ebnSehuhbCY58ctM8IRVMfNxxbJBp6ht9cbuLdGFNek="; subPackages = [ "cmd/caddy" ]; ldflags = [ "-s" "-w" "-X github.com/caddyserver/caddy/v2.CustomVersion=${version}" ]; nativeBuildInputs = [ installShellFiles ]; postInstall = '' install -Dm644 ${dist}/init/caddy.service ${dist}/init/caddy-api.service -t $out/lib/systemd/system substituteInPlace $out/lib/systemd/system/caddy.service --replace "/usr/bin/caddy" "$out/bin/caddy" substituteInPlace $out/lib/systemd/system/caddy-api.service --replace "/usr/bin/caddy" "$out/bin/caddy" $out/bin/caddy manpage --directory manpages installManPage manpages/* installShellCompletion --cmd caddy  --bash <($out/bin/caddy completion bash)  --fish <($out/bin/caddy completion fish)  --zsh <($out/bin/caddy completion zsh) ''; passthru.tests = { inherit (nixosTests) caddy; version = testers.testVersion { command = "${caddy}/bin/caddy version"; package = caddy; }; }; meta = with lib; { homepage = "https://caddyserver.com"; description = "Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS"; license = licenses.asl20; mainProgram = "caddy"; maintainers = with maintainers; [ Br1ght0ne emilylange techknowlogick ]; }; } </del>

<del> { lib, buildGoModule, fetchFromGitHub }: buildGoModule rec { pname = "xcaddy"; version = "0.4.1"; subPackages = [ "cmd/xcaddy" ]; src = fetchFromGitHub { owner = "caddyserver"; repo = pname; rev = "v${version}"; hash = "sha256-xEPSRKrQC9hb+G9/rV9/k4btvZxXZkcsxmaxWcgl2fk="; }; patches = [ ./inject_version_info.diff ./use_tmpdir_on_darwin.diff ]; ldflags = [ "-s" "-w" "-X github.com/caddyserver/xcaddy/cmd.customVersion=v${version}" ]; vendorHash = "sha256-7yd/6h1DKw7X/1NbHtr2vbpyapF81HPmDm7O4oV5nlc="; meta = with lib; { homepage = "https://github.com/caddyserver/xcaddy"; description = "Build Caddy with plugins"; mainProgram = "xcaddy"; license = licenses.asl20; maintainers = with maintainers; [ tjni emilylange ]; }; } </del>

<del> diff --git a/cmd/main.go b/cmd/main.go index ede7cd8..c553140 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -401,8 +401,11 @@ func splitWith(arg string) (module, version, replace string, err error) { return } +var customVersion string + // xcaddyVersion returns a detailed version string, if available. func xcaddyVersion() string { +	return customVersion mod := goModule() ver := mod.Version if mod.Sum != "" { </del>

<del> diff --git a/builder.go b/builder.go index ed6c5ef..36e8055 100644 --- a/builder.go +++ b/builder.go @@ -200,7 +200,7 @@ func NewReplace(old, new string) Replace { // It is the caller's responsibility to remove the folder when finished. func newTempFolder() (string, error) { var parentDir string -	if runtime.GOOS == "darwin" { +	if false && runtime.GOOS == "darwin" { // After upgrading to macOS High Sierra, Caddy builds mysteriously // started missing the embedded version information that -ldflags // was supposed to produce. But it only happened on macOS after </del>

''; }); <del> caddy = callPackage ../servers/caddy { }; xcaddy = callPackage ../servers/caddy/xcaddy { }; </del> traefik = callPackage ../servers/traefik { }; traefik-certs-dumper = callPackage ../tools/misc/traefik-certs-dumper { };