您将如何在最新的 macOS 上通过 nix 安装 openconnect?

How would you install openconnect via nix on macOS latest?

我是 nix 的新手,希望能够用它安装 openconnect。

Darwin 目前似乎不受 nix 支持,但可以使用 brew 或 macports 安装。

我已经尝试了基本安装和允许不受支持。我在 google 或 Whosebug 上还没有看到任何有用的东西。

基本安装结果

$ nix-env -i openconnect
warning: there are multiple derivations named 'openconnect-8.03'; using the first one
installing 'openconnect-8.03'
error: Package ‘«name-missing»’ in /nix/store/bsxpbjipz85ws3wbznhpgc38779pzak5-nixpkgs-19.09pre186574.88d9f776091/nixpkgs/pkgs/tools/networking/openconnect/default.nix:28 is not supported on ‘x86_64-darwin’, refusing to evaluate.

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

b) 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)

允许不支持的结果

$ NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix-env -i openconnect
warning: there are multiple derivations named 'openconnect-8.03'; using the first one
installing 'openconnect-8.03'
these derivations will be built:
  /nix/store/rf9afn87lch36bj7q61ks6rr3igsbv83-builder.pl.drv
  /nix/store/25pr0lcpbgdx78vpv2jb99sngzwq6b44-nettools-1003.1-2008.drv
  /nix/store/v9i3z3bh3jjzs80wj4jbb5vn37mwflah-openresolv-3.9.0.drv
  /nix/store/1i8i9qww079gm1l82bnggkpxphg27v9w-vpnc-0.5.3-post-r550.drv
  /nix/store/1fzxm6cdd5d2mgizkvqqx0zi0vg9ilpk-openconnect-8.03.drv
these paths will be fetched (157.54 MiB download, 811.71 MiB unpacked):
  /nix/store/02cjbymr9q0abw1vdy9i4c67dklgq4iq-autogen-5.18.12-lib
  /nix/store/09cdrnckixb7i5fsv2fc33rd7p5zx0n8-libjpeg-turbo-2.0.2
  /nix/store/0cifmxw0r6lijng796a3z3nwq67ma5b3-llvm-7.1.0-lib
  /nix/store/0x4jdm1dhb593bpgazqclg7np5mb9yp2-vpnc-r550
  /nix/store/1d1xq0r2zg4r1mk8f1ydfygw19i84lpq-fontconfig-2.12.6
  /nix/store/1ki1m09g8wnd5vzadcxh0pjwfz27zk8z-expand-response-params
  /nix/store/1qkqjb02khxr13q8hhwicznz5zsvjvzv-gnused-4.7
  /nix/store/28ciaclbgwii11yna529xim4w1cnc7bn-expat-2.2.7
  /nix/store/29alwmfhca3y5gj0fki5raahi2s6330n-nettle-3.4.1-dev
  /nix/store/2ia88csiygmwq9bprdlwdpj9ajnjw1wd-gtk+3-3.24.8
  /nix/store/2pj2hdfy8jqy41hbh5h6z7sqhmcpi7xy-cctools-binutils-darwin
  /nix/store/2x82drnhq64vpw0pj4gkgid0qhm7f20q-gnutls-3.6.8-dev
  /nix/store/33whmhh30l2c1cx65pakygv520fjsi96-jasper-2.0.16
  /nix/store/4366mxm4p1032s9s8l6pyzwz56xr9inb-libxml2-2.9.9-py
  /nix/store/49nmvn7iaxlahhc66w8b4y9j66n8fjlb-autogen-5.18.12
  /nix/store/4mjyhc65kdri28g59gpnjvimjkb44vpy-gawk-4.2.1
  /nix/store/4zn384psyqihmm6fnmavxw5w3509qgnw-Security-osx-10.9.5

  ...

configuring
building
build flags: SHELL=/nix/store/d9wxsyxsj3ssjcbywwm35254d14yv87a-bash-4.4-p23/bin/bash
sed     -e 's:@SBINDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/sbin:g' -e 's:@SYSCONFDIR@:/etc:g' -e 's:@LIBEXECDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/libexec/resolvconf:g' \
        -e 's:@VARDIR@:/run/resolvconf:g' \
        -e 's:@RCDIR@::g' -e 's:@RESTARTCMD@:false:g' -e 's:@RCDIR@::g' -e 's:@STATUSARG@::g' \
        resolvconf.in > resolvconf
sed     -e 's:@SBINDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/sbin:g' -e 's:@SYSCONFDIR@:/etc:g' -e 's:@LIBEXECDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/libexec/resolvconf:g' \
        -e 's:@VARDIR@:/run/resolvconf:g' \
        -e 's:@RCDIR@::g' -e 's:@RESTARTCMD@:false:g' -e 's:@RCDIR@::g' -e 's:@STATUSARG@::g' \
        resolvconf.8.in > resolvconf.8
sed     -e 's:@SBINDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/sbin:g' -e 's:@SYSCONFDIR@:/etc:g' -e 's:@LIBEXECDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/libexec/resolvconf:g' \
        -e 's:@VARDIR@:/run/resolvconf:g' \
        -e 's:@RCDIR@::g' -e 's:@RESTARTCMD@:false:g' -e 's:@RCDIR@::g' -e 's:@STATUSARG@::g' \
        resolvconf.conf.5.in > resolvconf.conf.5
sed     -e 's:@SBINDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/sbin:g' -e 's:@SYSCONFDIR@:/etc:g' -e 's:@LIBEXECDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/libexec/resolvconf:g' \
        -e 's:@VARDIR@:/run/resolvconf:g' \
        -e 's:@RCDIR@::g' -e 's:@RESTARTCMD@:false:g' -e 's:@RCDIR@::g' -e 's:@STATUSARG@::g' \
        libc.in > libc
sed     -e 's:@SBINDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/sbin:g' -e 's:@SYSCONFDIR@:/etc:g' -e 's:@LIBEXECDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/libexec/resolvconf:g' \
        -e 's:@VARDIR@:/run/resolvconf:g' \
        -e 's:@RCDIR@::g' -e 's:@RESTARTCMD@:false:g' -e 's:@RCDIR@::g' -e 's:@STATUSARG@::g' \
        dnsmasq.in > dnsmasq
sed     -e 's:@SBINDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/sbin:g' -e 's:@SYSCONFDIR@:/etc:g' -e 's:@LIBEXECDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/libexec/resolvconf:g' \
        -e 's:@VARDIR@:/run/resolvconf:g' \
        -e 's:@RCDIR@::g' -e 's:@RESTARTCMD@:false:g' -e 's:@RCDIR@::g' -e 's:@STATUSARG@::g' \
        named.in > named
sed     -e 's:@SBINDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/sbin:g' -e 's:@SYSCONFDIR@:/etc:g' -e 's:@LIBEXECDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/libexec/resolvconf:g' \
        -e 's:@VARDIR@:/run/resolvconf:g' \
        -e 's:@RCDIR@::g' -e 's:@RESTARTCMD@:false:g' -e 's:@RCDIR@::g' -e 's:@STATUSARG@::g' \
        pdnsd.in > pdnsd
sed     -e 's:@SBINDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/sbin:g' -e 's:@SYSCONFDIR@:/etc:g' -e 's:@LIBEXECDIR@:/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/libexec/resolvconf:g' \
        -e 's:@VARDIR@:/run/resolvconf:g' \
        -e 's:@RCDIR@::g' -e 's:@RESTARTCMD@:false:g' -e 's:@RCDIR@::g' -e 's:@STATUSARG@::g' \
        unbound.in > unbound
installing
install flags: SHELL=/nix/store/d9wxsyxsj3ssjcbywwm35254d14yv87a-bash-4.4-p23/bin/bash SYSCONFDIR=$\(out\)/etc install
install -d /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/sbin
install -m 0755 resolvconf /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/sbin
install -d /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/etc
test -e /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/etc/resolvconf.conf || \
install -m 0644 resolvconf.conf /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/etc
install -d /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/libexec/resolvconf
install -m 0644 libc dnsmasq named pdnsd unbound /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/libexec/resolvconf
install -d /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/share/man/man8
install -m 0444 resolvconf.8 /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/share/man/man8
install -d /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/share/man/man5
install -m 0444 resolvconf.conf.5 /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/share/man/man5
post-installation fixup
gzipping man pages under /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/share/man/
strip is /nix/store/2pj2hdfy8jqy41hbh5h6z7sqhmcpi7xy-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/libexec  /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/sbin 
patching script interpreter paths in /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0
/nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/sbin/.resolvconf-wrapped: interpreter directive changed from "/bin/sh" to "/nix/store/d9wxsyxsj3ssjcbywwm35254d14yv87a-bash-4.4-p23/bin/sh"
moving /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/sbin/* to /nix/store/izy3kb6035gl46dkxlhl09g2ghcg2hqp-openresolv-3.9.0/bin
building '/nix/store/25pr0lcpbgdx78vpv2jb99sngzwq6b44-nettools-1003.1-2008.drv'...
created 6 symlinks in user environment
building '/nix/store/1i8i9qww079gm1l82bnggkpxphg27v9w-vpnc-0.5.3-post-r550.drv'...
unpacking sources
unpacking source archive /nix/store/0x4jdm1dhb593bpgazqclg7np5mb9yp2-vpnc-r550
source root is vpnc-r550
patching sources
applying patch /nix/store/cjmd5815vwl3kfhm8f5yzrnd0zcms7ki-makefile.patch
patching file Makefile
Hunk #1 succeeded at 20 with fuzz 1.
Hunk #2 succeeded at 82 with fuzz 2 (offset 11 lines).
applying patch /nix/store/9lq5151d73q7m5d291qayz73828mky1f-no_default_route_when_netmask.patch
patching file vpnc-script
configuring
substituteStream(): WARNING: pattern '/usr/bin/perl' doesn't match anything in file 'pcf2vpnc'
no configure script, doing nothing

...


clang -O3 -g -W -Wall -Wmissing-declarations -Wwrite-strings -I/nix/store/f7pyl32f8jq8g2i62qqfrjwigi0znb1a-libgcrypt-1.8.4-dev/include -I/nix/store/5pnsm2flly4w5zi0d1qlvz0zs71jwlv9-libgpg-error-1.36-dev/include -DOPENSSL_GPL_VIOLATION -DCRYPTO_OPENSSL -DVERSION=\"0.5.3\"  -c -o config.o config.c
config.c:212:6: warning: variable 'pass' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (WEXITSTATUS(status) != 0) {
            ^~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/bhywddq18j79xr274n45byvqjb8fs52j-Libsystem-osx-10.12.6/include/sys/wait.h:144:24: note: expanded from macro 'WEXITSTATUS'
#define WEXITSTATUS(x)  ((_W_INT(x) >> 8) & 0x000000ff)
                        ^
config.c:242:9: note: uninitialized use occurs here
        return pass;
               ^~~~
config.c:212:2: note: remove the 'if' if its condition is always false
        if (WEXITSTATUS(status) != 0) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
config.c:207:6: warning: variable 'pass' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (!WIFEXITED(status)) {
            ^~~~~~~~~~~~~~~~~~
config.c:242:9: note: uninitialized use occurs here
        return pass;
               ^~~~
config.c:207:2: note: remove the 'if' if its condition is always false
        if (!WIFEXITED(status)) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~
config.c:204:6: warning: variable 'pass' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (r == -1)
            ^~~~~~~
config.c:242:9: note: uninitialized use occurs here
        return pass;
               ^~~~
config.c:204:2: note: remove the 'if' if its condition is always false
        if (r == -1)
        ^~~~~~~~~~~~
config.c:177:6: warning: variable 'pass' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (pid == -1)
            ^~~~~~~~~
config.c:242:9: note: uninitialized use occurs here
        return pass;
               ^~~~
config.c:177:2: note: remove the 'if' if its condition is always false
        if (pid == -1)
        ^~~~~~~~~~~~~~
config.c:173:6: warning: variable 'pass' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (pipe(fds) == -1)
            ^~~~~~~~~~~~~~~
config.c:242:9: note: uninitialized use occurs here
        return pass;
               ^~~~
config.c:173:2: note: remove the 'if' if its condition is always false
        if (pipe(fds) == -1)
        ^~~~~~~~~~~~~~~~~~~~
config.c:170:12: note: initialize the variable 'pass' to silence this warning
        char *pass;
                  ^
                   = NULL
5 warnings generated.
clang -O3 -g -W -Wall -Wmissing-declarations -Wwrite-strings -I/nix/store/f7pyl32f8jq8g2i62qqfrjwigi0znb1a-libgcrypt-1.8.4-dev/include -I/nix/store/5pnsm2flly4w5zi0d1qlvz0zs71jwlv9-libgpg-error-1.36-dev/include -DOPENSSL_GPL_VIOLATION -DCRYPTO_OPENSSL -DVERSION=\"0.5.3\"  -c -o dh.o dh.c
clang -O3 -g -W -Wall -Wmissing-declarations -Wwrite-strings -I/nix/store/f7pyl32f8jq8g2i62qqfrjwigi0znb1a-libgcrypt-1.8.4-dev/include -I/nix/store/5pnsm2flly4w5zi0d1qlvz0zs71jwlv9-libgpg-error-1.36-dev/include -DOPENSSL_GPL_VIOLATION -DCRYPTO_OPENSSL -DVERSION=\"0.5.3\"  -c -o math_group.o math_group.c
clang -O3 -g -W -Wall -Wmissing-declarations -Wwrite-strings -I/nix/store/f7pyl32f8jq8g2i62qqfrjwigi0znb1a-libgcrypt-1.8.4-dev/include -I/nix/store/5pnsm2flly4w5zi0d1qlvz0zs71jwlv9-libgpg-error-1.36-dev/include -DOPENSSL_GPL_VIOLATION -DCRYPTO_OPENSSL -DVERSION=\"0.5.3\"  -c -o supp.o supp.c
clang -O3 -g -W -Wall -Wmissing-declarations -Wwrite-strings -I/nix/store/f7pyl32f8jq8g2i62qqfrjwigi0znb1a-libgcrypt-1.8.4-dev/include -I/nix/store/5pnsm2flly4w5zi0d1qlvz0zs71jwlv9-libgpg-error-1.36-dev/include -DOPENSSL_GPL_VIOLATION -DCRYPTO_OPENSSL -DVERSION=\"0.5.3\"  -c -o decrypt-utils.o decrypt-utils.c
clang -O3 -g -W -Wall -Wmissing-declarations -Wwrite-strings -I/nix/store/f7pyl32f8jq8g2i62qqfrjwigi0znb1a-libgcrypt-1.8.4-dev/include -I/nix/store/5pnsm2flly4w5zi0d1qlvz0zs71jwlv9-libgpg-error-1.36-dev/include -DOPENSSL_GPL_VIOLATION -DCRYPTO_OPENSSL -DVERSION=\"0.5.3\"  -c -o crypto.o crypto.c
clang -O3 -g -W -Wall -Wmissing-declarations -Wwrite-strings -I/nix/store/f7pyl32f8jq8g2i62qqfrjwigi0znb1a-libgcrypt-1.8.4-dev/include -I/nix/store/5pnsm2flly4w5zi0d1qlvz0zs71jwlv9-libgpg-error-1.36-dev/include -DOPENSSL_GPL_VIOLATION -DCRYPTO_OPENSSL -DVERSION=\"0.5.3\"  -c -o crypto-openssl.o crypto-openssl.c
crypto-openssl.c:66:30: warning: unused parameter 'buf' [-Wunused-parameter]
static int password_cb(char *buf, int size, int rwflag, void *userdata)
                             ^
crypto-openssl.c:66:39: warning: unused parameter 'size' [-Wunused-parameter]
static int password_cb(char *buf, int size, int rwflag, void *userdata)
                                      ^
crypto-openssl.c:66:49: warning: unused parameter 'rwflag' [-Wunused-parameter]
static int password_cb(char *buf, int size, int rwflag, void *userdata)
                                                ^
crypto-openssl.c:66:63: warning: unused parameter 'userdata' [-Wunused-parameter]
static int password_cb(char *buf, int size, int rwflag, void *userdata)
                                                              ^
4 warnings generated.
clang -O3 -g -W -Wall -Wmissing-declarations -Wwrite-strings -I/nix/store/f7pyl32f8jq8g2i62qqfrjwigi0znb1a-libgcrypt-1.8.4-dev/include -I/nix/store/5pnsm2flly4w5zi0d1qlvz0zs71jwlv9-libgpg-error-1.36-dev/include -DOPENSSL_GPL_VIOLATION -DCRYPTO_OPENSSL -DVERSION=\"0.5.3\"  -c -o vpnc.o vpnc.c
vpnc.c:1901:39: warning: 'memset' call operates on objects of type 'unsigned char' while the size is based on a different type 'unsigned char *' [-Wsizeof-pointer-memaccess]
                        memset(dh_shared_secret, 0, sizeof(dh_shared_secret));
                               ~~~~~~~~~~~~~~~~            ^~~~~~~~~~~~~~~~
vpnc.c:1901:39: note: did you mean to provide an explicit length?
                        memset(dh_shared_secret, 0, sizeof(dh_shared_secret));
                                                           ^~~~~~~~~~~~~~~~
1 warning generated.

...

checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '501' is supported by ustar format... yes
checking whether GID '20' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking whether clang understands -c and -o together... yes
checking dependency style of clang... none
checking for fdevname_r... no
checking for statfs... yes
checking for getline... yes
checking for strcasestr... yes
checking for strndup... yes
checking for asprintf... yes
checking for vasprintf... yes
checking for supported compiler flags...  -Wall -Wextra -Wno-missing-field-initializers -Wno-sign-compare -Wno-unused-parameter -Werror=pointer-to-int-cast -Wdeclaration-after-statement -Werror-implicit-function-declaration -Wformat-nonliteral -Wformat-security -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wnested-externs -Wpointer-arith -Wwrite-strings
checking For memset_s... yes
checking for socket... yes
checking for inet_aton... yes
checking for IPV6_PATHMTU socket option... no
checking for __android_log_vprint... no
checking for __android_log_vprint in -llog... no
checking for nl_langinfo... yes
checking for ld used by clang... ld
checking if the linker (ld) is GNU ld... no
checking for shared library run path origin... done
checking how to run the C preprocessor... clang -E
checking for grep that handles long lines and -e... /nix/store/bzr287y1sy2qsrmywwkgxlkblz7vx61w-gnugrep-3.3/bin/grep
checking for egrep... /nix/store/bzr287y1sy2qsrmywwkgxlkblz7vx61w-gnugrep-3.3/bin/grep -E
checking for iconv... no, consider installing GNU libiconv
checking for GNUTLS... yes
checking for gnutls_system_key_add_x509... yes
checking for gnutls_pkcs11_add_provider... yes
checking for P11KIT... no
checking for tss library... no
checking for TASN1... no
checking for LIBLZ4... no
configure: WARNING:
***
*** lz4 not found.
*** 
checking for egrep... (cached) /nix/store/bzr287y1sy2qsrmywwkgxlkblz7vx61w-gnugrep-3.3/bin/grep -E
checking how to print strings... printf
checking for a sed that does not truncate output... /nix/store/1qkqjb02khxr13q8hhwicznz5zsvjvzv-gnused-4.7/bin/sed
checking for fgrep... /nix/store/bzr287y1sy2qsrmywwkgxlkblz7vx61w-gnugrep-3.3/bin/grep -F
checking for ld used by clang... ld
checking if the linker (ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... nm
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking how to convert x86_64-apple-darwin18.7.0 file names to x86_64-apple-darwin18.7.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin18.7.0 file names to toolchain format... func_convert_file_noop
checking for ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse nm output from clang object... ok
checking for sysroot... no
checking for a working dd... /nix/store/6964byz5cbs03s8zckqn72i6zq12ipqv-coreutils-8.31/bin/dd
checking how to truncate binary pipes... /nix/store/6964byz5cbs03s8zckqn72i6zq12ipqv-coreutils-8.31/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... no
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if clang supports -fno-rtti -fno-exceptions... yes
checking for clang option to produce PIC... -fno-common -DPIC
checking if clang PIC flag -fno-common -DPIC works... yes
checking if clang static flag -static works... no
checking if clang supports -c -o file.o... yes
checking if clang supports -c -o file.o... (cached) yes
checking whether the clang linker (ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin18.7.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking linker version script flag... unsupported
checking for LIBXML2... yes
checking for ZLIB... yes
checking for LIBPROXY... no
checking for libproxy... no
checking for LIBSTOKEN... yes
checking for LIBPSKC... no
checking for krb5-config... no
checking gssapi/gssapi.h usability... no
checking gssapi/gssapi.h presence... no
checking for gssapi/gssapi.h... no
checking gssapi.h usability... no
checking gssapi.h presence... no
checking for gssapi.h... no
configure: WARNING: Cannot find <gssapi/gssapi.h> or <gssapi.h>
configure: WARNING: Building without GSSAPI support
checking if_tun.h usability... no
checking if_tun.h presence... no
checking for if_tun.h... no
checking linux/if_tun.h usability... no
checking linux/if_tun.h presence... no
checking for linux/if_tun.h... no
checking net/if_tun.h usability... no
checking net/if_tun.h presence... no
checking for net/if_tun.h... no
checking net/tun/if_tun.h usability... no
checking net/tun/if_tun.h presence... no
checking for net/tun/if_tun.h... no
checking for net/if_utun.h... yes
checking alloca.h usability... yes
checking alloca.h presence... yes
checking for alloca.h... yes
checking endian.h usability... no
checking endian.h presence... no
checking for endian.h... no
checking sys/endian.h usability... no
checking sys/endian.h presence... no
checking for sys/endian.h... no
checking sys/isa_defs.h usability... no
checking sys/isa_defs.h presence... no
checking for sys/isa_defs.h... no
checking for python3... no
checking for python2... no
checking for python... /usr/bin/python
checking if groff can create UTF-8 XHTML... no. Not building HTML pages
checking for CWRAP... no
checking for nuttcp... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating openconnect.pc
config.status: creating po/Makefile
config.status: creating www/Makefile
config.status: creating libopenconnect.map
config.status: creating openconnect.8
config.status: creating www/styles/Makefile
config.status: creating www/inc/Makefile
config.status: creating www/images/Makefile
config.status: creating tests/Makefile
config.status: creating tests/softhsm2.conf
config.status: creating tests/configs/test-user-cert.config
config.status: creating tests/configs/test-user-pass.config
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
BUILD OPTIONS:
  SSL library:            GnuTLS
  PKCS#11 support:        no
  DTLS support:           yes
  ESP support:            yes
  libproxy support:       no
  RSA SecurID support:    yes
  PSKC OATH file support: no
  GSSAPI support:         no
  Yubikey support:        yes
  LZ4 compression:        no
  Java bindings:          no
  Build docs:             no
  Unit tests:             no
  Net namespace tests:    no
building
build flags: SHELL=/nix/store/d9wxsyxsj3ssjcbywwm35254d14yv87a-bash-4.4-p23/bin/bash
make  all-recursive
make[1]: Entering directory '/private/var/folders/6j/j96x43893xd3vst_44_w7pqm0000gn/T/nix-build-openconnect-8.03.drv-0/openconnect-8.03'
  CC       libopenconnect_la-version.lo
  CC       libopenconnect_la-ssl.lo
  CC       libopenconnect_la-http.lo
  CC       libopenconnect_la-http-auth.lo
  CC       libopenconnect_la-auth-common.lo
  CC       libopenconnect_la-library.lo
  CC       libopenconnect_la-compat.lo
  CC       libopenconnect_la-lzs.lo
  CC       libopenconnect_la-mainloop.lo
  CC       libopenconnect_la-script.lo
  CC       libopenconnect_la-ntlm.lo
  CC       libopenconnect_la-digest.lo
  CC       libopenconnect_la-oncp.lo
  CC       libopenconnect_la-lzo.lo
  CC       libopenconnect_la-auth-juniper.lo
  CC       libopenconnect_la-esp.lo
  CC       libopenconnect_la-esp-seqno.lo
  CC       libopenconnect_la-gnutls-esp.lo
  CC       libopenconnect_la-auth.lo
  CC       libopenconnect_la-cstp.lo
  CC       libopenconnect_la-dtls.lo
  CC       libopenconnect_la-gnutls-dtls.lo
  CC       libopenconnect_la-oath.lo
  CC       libopenconnect_la-gpst.lo
  CC       libopenconnect_la-auth-globalprotect.lo
  CC       libopenconnect_la-yubikey.lo
yubikey.c:63:10: fatal error: 'PCSC/wintypes.h' file not found
#include <PCSC/wintypes.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [Makefile:1163: libopenconnect_la-yubikey.lo] Error 1
make[1]: Leaving directory '/private/var/folders/6j/j96x43893xd3vst_44_w7pqm0000gn/T/nix-build-openconnect-8.03.drv-0/openconnect-8.03'
make: *** [Makefile:697: all] Error 2
builder for '/nix/store/1fzxm6cdd5d2mgizkvqqx0zi0vg9ilpk-openconnect-8.03.drv' failed with exit code 2
error: build of '/nix/store/1fzxm6cdd5d2mgizkvqqx0zi0vg9ilpk-openconnect-8.03.drv’ failed

自然希望安装成功。

有谁知道如何在 macOS 上进行这种安装以及如何通过 nix 配置它?

如果你想为 macOS 修复这个派生,方法是在 github 上 fork nixpkgs,然后从你的本地克隆:

nix-build -A openconnect

openconnect 推导在pkgs/tools/networking/openconnect/default.nix 缺失的 C header 似乎来自 pcsclite。我通常通过 google + 完成例如 nix-build -A pcsc[TAB].

来发现依赖关系

安装失败,因为 yubikey 需要 PCSC 框架依赖项。我在 this 拉取请求中解决了这个问题。由于它已合并到 nixpkgs master 分支中,您现在应该能够在 Catalina 上安装 openconnect。