NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.06k stars 14.11k forks source link

Build failure: surrealdb-migrations #304543

Open 5hanth opened 6 months ago

5hanth commented 6 months ago

Steps To Reproduce

Steps to reproduce the behavior:

  1. build surrealdb-migrations on nixpkgs-unstable

Build log

   >   = note: ld: framework not found SystemConfiguration
       >           clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
       >
       >
       > error: could not compile `surrealdb-migrations` (bin "surrealdb-migrations") due to 1 previous error
       For full logs, run 'nix-store -l /nix/store/6k6awda85gy6z3b29314aj0bzn54khwy-surrealdb-migrations-1.1.0.drv'.

Additional context

flake.nix

{
  inputs = {
    naersk.url = "github:nix-community/naersk/master";
    nixpkgs = { url = "github:NixOS/nixpkgs/nixpkgs-unstable";
                };
    utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, utils, naersk }:
    utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs { inherit system; config.allowUnfree = true; };
        naersk-lib = pkgs.callPackage naersk { };
      in
      {
        defaultPackage = naersk-lib.buildPackage ./.;
        devShell = with pkgs; mkShell {
          buildInputs = [ llvmPackages.lld iconv cargo rustc rustfmt pre-commit trunk cargo-generate rustPackages.clippy surrealdb  surrealdb-migrations ] ++  [darwin.apple_sdk.frameworks.SystemConfiguration
           darwin.apple_sdk.frameworks.Security
           darwin.apple_sdk.frameworks.System
            ];
          RUST_SRC_PATH = rustPlatform.rustLibSrc;
          shellHook = ''
export NIX_LDFLAGS="-F${pkgs.darwin.apple_sdk.frameworks.System}/Library/Frameworks -framework SystemConfiguration $NIX_LDFLAGS"

            export RUSTFLAGS="-C linker=lld"
          '';
        };
      }
    );
}

Metadata

 - system: `"aarch64-darwin"`
 - host os: `Darwin 23.2.0, macOS 14.2.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.19.3`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

peanutbother commented 5 months ago

I can confirm this is happening. also tried various scenarios where I put apple sdk into buildInputs and nativeBuildInputs. it seems the derivation does not use build inputs or discards them, at least for buildInputs the derivation is missing SystemConfiguration here: https://github.com/NixOS/nixpkgs/blob/ba8358bb9716f9a4d5844aaa9341f3894499ee7d/pkgs/development/tools/database/surrealdb-migrations/default.nix#L30

Metadata

 - system: `"aarch64-darwin"`
 - host os: `Darwin 23.5.0, macOS 14.5.1(23F79)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`