From 4673e3b79ed9f8dad1395756fd5f4424a66f74c2 Mon Sep 17 00:00:00 2001 From: Yureka Date: Tue, 20 May 2025 12:37:21 +0200 Subject: [PATCH] attic-server: don't depend on nix --- pkgs/by-name/at/attic-client/package.nix | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/at/attic-client/package.nix b/pkgs/by-name/at/attic-client/package.nix index 99b38d0e0228..3b8a97074e52 100644 --- a/pkgs/by-name/at/attic-client/package.nix +++ b/pkgs/by-name/at/attic-client/package.nix @@ -10,6 +10,11 @@ installShellFiles, crates ? [ "attic-client" ], }: +let + # Only the attic-client crate builds against the Nix C++ libs + # This derivation is also used to build the server + needNixInclude = lib.elem "attic-client" crates; +in rustPlatform.buildRustPackage { pname = "attic"; version = "0-unstable-2025-02-02"; @@ -26,8 +31,7 @@ rustPlatform.buildRustPackage { installShellFiles ]; - buildInputs = [ - nixVersions.nix_2_24 + buildInputs = lib.optional needNixInclude nixVersions.nix_2_24 ++ [ boost ]; @@ -35,8 +39,13 @@ rustPlatform.buildRustPackage { cargoHash = "sha256-AbpWnYfBMrR6oOfy2LkQvIPYsClCWE89bJav+iHTtLM="; useFetchCargoVendor = true; - ATTIC_DISTRIBUTOR = "nixpkgs"; - NIX_INCLUDE_PATH = "${lib.getDev nixVersions.nix_2_24}/include"; + env = + { + ATTIC_DISTRIBUTOR = "nixpkgs"; + } + // lib.optionalAttrs needNixInclude { + NIX_INCLUDE_PATH = "${lib.getDev nixVersions.nix_2_24}/include"; + }; # Attic interacts with Nix directly and its tests require trusted-user access # to nix-daemon to import NARs, which is not possible in the build sandbox.