Code Monkey home page Code Monkey logo

Comments (8)

yusdacra avatar yusdacra commented on August 24, 2024 1

I made a PR (#73) that should fix this. The issue was caused by nixpkgs's defaultCrateOverrides, https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/rust/default-crate-overrides.nix#L172-L174. These lines add Security regardless of the current platform, which triggers this issue. For now I've included a workaround in nix-cargo-integration, but I am making a PR to nixpkgs.

from nix-cargo-integration.

khrj avatar khrj commented on August 24, 2024

From what I understand, this is caused by reqwest's default-tls feature, which adds a dependency on native-tls, which depends on security-framework, but only when building for macOS. security-framework provides bindings for the MacOS SDK's Security.framework

native-tls's Cargo.toml (irrelevant sections removed):

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
security-framework = "2.0.0"
security-framework-sys = "2.0.0"

[target.'cfg(not(any(target_os = "windows", target_os = "macos", target_os = "ios")))'.dependencies]
openssl = "0.10.29"
openssl-sys = "0.9.55"
openssl-probe = "0.1"

[target.'cfg(not(any(target_os = "windows", target_os = "macos", target_os = "ios")))'.build_dependencies]
openssl-src = { version = "300.0.3", optional = true }

Adding just native-tls to Cargo.toml instead of reqwest produces a similar error:

native-tls = "0.2"
error: Package ‘MacOS_SDK-10.12’ in /nix/store/hsff9pi1qinxljahr833z0xivr1apx27-source/pkgs/os-specific/darwin/apple-sdk/default.nix:50 is not supported on ‘x86_64-linux’, refusing to evaluate.
...

from nix-cargo-integration.

khrj avatar khrj commented on August 24, 2024

Could this be an issue with the Cargo.lock translator not picking it up?

from nix-cargo-integration.

yusdacra avatar yusdacra commented on August 24, 2024

I've also experienced this issue. Thanks for filing this, haven't had time really.

I'm not sure why it's trying to use MacOS_SDK-10.12. Normally a dependency like that wouldn't be used unless we were on darwin, but it seems to be used anyways, which makes me think it could be an issue related to overrides.

It would be helpful if you could try to build with NCI_DEBUG=1 nix build --impure and post the output. I'll try to look into it more whenever I have time.

from nix-cargo-integration.

khrj avatar khrj commented on August 24, 2024
❯ NCI_DEBUG=1 nix build --impure
trace: root at: /nix/store/8f9kibyd69lb0kf5pph0hsna8nfa0idq-2h6x3j10r6jkb7i4mik3g8wqsffi2cbh-source
trace: workspace members:
trace: {
  message = "temp-0.1.0: root is";
  value = /nix/store/2h6x3j10r6jkb7i4mik3g8wqsffi2cbh-source;
}
trace:

The dream-lock.json for input 'temp' doesn't exist or is outdated.
...Falling back to on-the-fly evaluation (possibly slow).
To speed up future evalutations run once:
  nix run .#resolve

trace: {
  message = "temp-0.1.0: using builder";
  value = "crane";
}
trace: {
  message = "temp-0.1.0: rawTomlOverrides";
  value = {
    autocfg = <function>;
    bitflags = <function>;
    cc = <function>;
    cfg-if = <function>;
    core-foundation = <function>;
    core-foundation-sys = <function>;
    fastrand = <function>;
    foreign-types = <function>;
    foreign-types-shared = <function>;
    instant = <function>;
    lazy_static = <function>;
    libc = <function>;
    log = <function>;
    native-tls = <function>;
    once_cell = <function>;
    openssl = <function>;
    openssl-probe = <function>;
    openssl-sys = <function>;
    pkg-config = <function>;
    redox_syscall = <function>;
    remove_dir_all = <function>;
    schannel = <function>;
    security-framework = <function>;
    security-framework-sys = <function>;
    temp = <function>;
    temp-deps = <function>;
    tempfile = <function>;
    vcpkg = <function>;
    winapi = <function>;
    winapi-i686-pc-windows-gnu = <function>;
    winapi-x86_64-pc-windows-gnu = <function>;
  };
}
trace: {
  message = "temp-0.1.0: tomlOverrides";
  value = {
    autocfg = <function>;
    bitflags = <function>;
    cc = <function>;
    cfg-if = <function>;
    core-foundation = <function>;
    core-foundation-sys = <function>;
    fastrand = <function>;
    foreign-types = <function>;
    foreign-types-shared = <function>;
    instant = <function>;
    lazy_static = <function>;
    libc = <function>;
    log = <function>;
    native-tls = <function>;
    once_cell = <function>;
    openssl = <function>;
    openssl-probe = <function>;
    openssl-sys = <function>;
    pkg-config = <function>;
    redox_syscall = <function>;
    remove_dir_all = <function>;
    schannel = <function>;
    security-framework = <function>;
    security-framework-sys = <function>;
    temp = <function>;
    temp-deps = <function>;
    tempfile = <function>;
    vcpkg = <function>;
    winapi = <function>;
    winapi-i686-pc-windows-gnu = <function>;
    winapi-x86_64-pc-windows-gnu = <function>;
  };
}
trace: {
  message = "temp-0.1.0: buildPhase";
  value = ''
    runHook preBuild
    echo running: 'cargo build --release --message-format json-render-diagnostics >"$cargoBuildLog"'
    cargoBuildLog=$(mktemp cargoBuildLogXXXX.json)
    cargo build --release --message-format json-render-diagnostics >"$cargoBuildLog"
    runHook postBuild
  '';
}
error: Package ‘MacOS_SDK-10.12’ in /nix/store/hsff9pi1qinxljahr833z0xivr1apx27-source/pkgs/os-specific/darwin/apple-sdk/default.nix:50 is not supported on ‘x86_64-linux’, refusing to evaluate.

       a) To temporarily allow packages that are unsupported for this system, you can use an environment variable
          for a single invocation of the nix tools.

            $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1

        Note: For `nix shell`, `nix build`, `nix develop` or any other Nix 2.4+
        (Flake) command, `--impure` must be passed in order to read this
        environment variable.

       b) For `nixos-rebuild` you can set
         { nixpkgs.config.allowUnsupportedSystem = true; }
       in configuration.nix to override this.

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allowUnsupportedSystem = true; }
       to ~/.config/nixpkgs/config.nix.
(use '--show-trace' to show detailed location information)

from nix-cargo-integration.

tennox avatar tennox commented on August 24, 2024

I have the same problem but reported it in the wrong repo:
yusdacra/rust-nix-templater#22

Logs & Repo

See CI logs
See Repo

And the full log

from nix-cargo-integration.

tennox avatar tennox commented on August 24, 2024

@khrj Did you find a workaround?
Would love to use this as it seems like the simplest nix rust base I've found

from nix-cargo-integration.

khrj avatar khrj commented on August 24, 2024

I can confirm this works! 🎉

from nix-cargo-integration.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.