diff --git a/pkgs/by-name/pi/pizauth/package.nix b/pkgs/by-name/pi/pizauth/package.nix index 1d0a5f9bb3cf..a23a84d38ffb 100644 --- a/pkgs/by-name/pi/pizauth/package.nix +++ b/pkgs/by-name/pi/pizauth/package.nix @@ -4,6 +4,7 @@ fetchFromGitHub, stdenv, nix-update-script, + enableSystemd ? stdenv.hostPlatform.isLinux, }: rustPlatform.buildRustPackage (finalAttrs: { @@ -19,17 +20,25 @@ rustPlatform.buildRustPackage (finalAttrs: { cargoHash = "sha256-pxzPcieUXE3VOyGNDaeDHUQPayRDZXpW57VWMejlZ4k="; - buildFeatures = lib.optionals stdenv.hostPlatform.isLinux [ + buildFeatures = lib.optionals enableSystemd [ "systemd" ]; preConfigure = '' substituteInPlace lib/systemd/user/pizauth.service \ --replace-fail /usr/bin/ ''${!outputBin}/bin/ + # Upstream's Makefile uses target/release/pizauth as a Makefile target that + # the `install` target depends upon. Nixpkgs' cargoBuildHook defaults to + # using the explicit `--target @rustcTargetSpec@` flag, so that the + # executable always ends up in + # `target/${stdenv.hostPlatform.rust.rustcTargetSpec}/release`. To make the + # Makefile not run cargo build again, we use this substitution. + substituteInPlace Makefile \ + --replace-fail target/release target/${stdenv.hostPlatform.rust.rustcTargetSpec}/release ''; postInstall = '' - make PREFIX=$out install ${lib.optionalString stdenv.hostPlatform.isLinux "install-systemd"} + make PREFIX=$out install ${lib.optionalString enableSystemd "install-systemd"} ''; passthru.updateScript = nix-update-script { extraArgs = [ "--version-regex=pizauth-(.*)" ]; };