Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x509-system: use /usr/bin/security on macOS. #974

Merged
merged 1 commit into from
Dec 16, 2020
Merged

x509-system: use /usr/bin/security on macOS. #974

merged 1 commit into from
Dec 16, 2020

Conversation

dhess
Copy link
Contributor

@dhess dhess commented Dec 16, 2020

This mirrors the workaround in nixpkgs for haskellPackages.

ref: NixOS/nixpkgs#47676

This mirrors the workaround in nixpkgs for haskellPackages.

ref: NixOS/nixpkgs#47676
# https://github.com/NixOS/nixpkgs/pull/47676
# https://github.com/NixOS/nixpkgs/issues/45042
x509-system.components.library.preBuild = "substituteInPlace System/X509/MacOS.hs --replace security /usr/bin/security";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work if x509-system isn't in the package set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using this in a temporary fork to build all kinds of packages, including some non-Stack projects. (It's Stack that pulls in x509-system 100%.)

My expectation was that this expression wouldn't be evaluated unless the package set includes x509-system.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. I actually just don't know what the module system will do with this. e.g. I could imagine it complaining that x509-system wasn't defined or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, the real question about this PR is whether the conditional that guards the override is correct. In nixpkgs, my understanding is that you just need to use stdenv.isDarwin and that does the right thing for native builds and cross. But I get the impression (having not tried it myself) that cross-compiles are more complicated in haskell.nix, so it would be good to have someone who knows that stuff take a look at this PR.

There is also the complication that in nixpkgs, the equivalent code checks for !pkgs.stdenv.cc.nativeLibc, which I have mimicked here, but I confess that I don't understand why that's necessary:

https://github.com/NixOS/nixpkgs/blob/50863eb06c8f2f3397fa4cf0129a62047fbb765c/pkgs/development/haskell-modules/configuration-nix.nix#L160

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use stdenv.isDarwin all over the place, so I'm fairly confident that this is going to be okay. I have no idea about the nativeLibc thing, but I'm happy if we're copying it from nixpkgs.

I was about to ask if we should make a note to await the "proper fix" mentioned in the issue, and then I saw it was from 2018 😅

@michaelpj
Copy link
Collaborator

bors try

iohk-bors bot added a commit that referenced this pull request Dec 16, 2020
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Dec 16, 2020

@michaelpj
Copy link
Collaborator

Looks good, thanks for this!

@michaelpj michaelpj merged commit c9dde4d into input-output-hk:master Dec 16, 2020
booniepepper pushed a commit to booniepepper/haskell.nix that referenced this pull request Feb 4, 2022
This mirrors the workaround in nixpkgs for haskellPackages.

ref: NixOS/nixpkgs#47676
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants