Skip to content

Commit 31171a5

Browse files
committed
Make /usr/bin/security available in pure nix shell
Downloading from https://hackage.haskell.org/ would otherwise fail with: ``` HttpExceptionRequest Request { host = "hackage.haskell.org" port = 443 secure = True requestHeaders = [("Accept-Encoding",""),("User-Agent","Haskell pantry package")] path = "/root.json" queryString = "" method = "GET" proxy = Nothing rawBody = False redirectCount = 10 responseTimeout = ResponseTimeoutDefault requestVersion = HTTP/1.1 proxySecureMode = ProxySecureWithConnect } (InternalException (HandshakeFailed (Error_Protocol "certificate rejected: security: createProcess: posix_spawnp: does not exist (No such file or directory)" CertificateUnknown))) ``` See commercialhaskell/stack#4558
1 parent fc1f69c commit 31171a5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

shell.nix

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
{ pkgs ? import ./nixpkgs { }, docTools ? true, ghcVersion ? "9.2.8" }:
22

33
with pkgs;
4+
5+
let
6+
macOS-security =
7+
# make `/usr/bin/security` available in `PATH`, which is needed for stack
8+
# on darwin which calls this binary to find certificates
9+
writeScriptBin "security" ''exec /usr/bin/security "$@"'';
10+
in
411
mkShell {
512
# XXX: hack for macosX, this flags disable bazel usage of xcode
613
# Note: this is set even for linux so any regression introduced by this flag
@@ -36,7 +43,9 @@ mkShell {
3643
# check the start script for problems
3744
shellcheck
3845
file
39-
] ++ lib.optionals docTools [ graphviz python39Packages.sphinx zip unzip ];
46+
]
47+
++ lib.optionals docTools [ graphviz python39Packages.sphinx zip unzip ]
48+
++ lib.optional stdenv.isDarwin macOS-security;
4049

4150
packages = [ bazel_6 ];
4251

0 commit comments

Comments
 (0)