I’ve created a package to install VirtualBox on Darwin, which I need help to build and test. This is the first nix package that I’ve created, and admittedly not the simplest case.
There is an existing (linux only) package for VirtualBox at ‘pkgs/applications/virtualization/virtualbox/default.nix’.
To avoid interfering with the existing package, I have added ‘pkgs/applications/virtualization/virtualbox/6.x.nix’.
Since the filename convention is different the build command is not working. nix-build -f . -A virtualbox-6.0.4
Since the filename convention is different the build command is not working. nix-build -f . -A virtualbox-6.0.4
The filename doesn’t have anything to do with it – you need to add your package to pkgs/top-level/all-packages.nix.
FWIW, your package doesn’t actually build VirtualBox, it just downloads a prebuilt binary. This is generally frowned upon in Nixpkgs (although there’s not a hard rule against it).
I understand. I’ll work on a derivation to build from source, once I have a better understanding of writing derivations. Many Mac apps are closed source, but fortunately I believe the Mac derivation can build from source in this case.
I ran nix-shell . -A virtualbox6, from the top level of my Nixpkgs working directory. The derivation is found, but here are some errors.
these derivations will be built:
/nix/store/3cws4pww9fxq08283ypagvd41y4jnx7a-stdenv-darwin.drv
/nix/store/b3vyrfzarzyh51n7fj9wrpw12sq3765l-stdenv-darwin.drv
/nix/store/s6mgn0ai506132nblpwr80m1nd875rf7-perl-5.28.1.drv
/nix/store/7k9gj5s4khn7ayvlzqwibj3g3ay2zwjk-openssl-1.0.2r.drv
/nix/store/a0mc36s0jq0g53h5mriw1smgh8b0dcl0-c-ares-1.15.0.drv
/nix/store/bdd1cmvg7kvnwhgjzlp6pp3mbxgx5hcw-libev-4.25.drv
/nix/store/npl2ypmmnppplsjapxml0yh98fcv6788-pkg-config-0.29.2.drv
/nix/store/7ic1fwshnqlyc4fs2kg6fi8svk4v33ln-nghttp2-1.37.0.drv
/nix/store/a9g38abifpx2djybq6z0v3rkf6kwda9i-libssh2-1.8.1.drv
/nix/store/602s3asbfc7wk08i2arnaq559aa1yhvz-curl-7.64.0.drv
/nix/store/qx5hz52yhs533jx4br9cizcjin62bi13-mirrors-list.drv
/nix/store/24knxq6n5744r9922qp55dhw77035031-VirtualBox-6.0.4-128414-OSX.dmg.drv
/nix/store/6wm36yvhnkc3zyz3jrnq2rj6rprx882i-undmg-1.0.3.drv
building '/nix/store/b3vyrfzarzyh51n7fj9wrpw12sq3765l-stdenv-darwin.drv'...
output '/nix/store/3agkxvkbhfpimnx5imr09q4rq9pxmjda-stdenv-darwin' is not allowed to refer to the following paths:
/nix/store/jnzhx3hni0ds1wf49z8wfnxi3qdnkk6q-gnum4-1.4.18
/nix/store/smdncnz5pkl5q39k4ldk8bh84p2hmj19-bison-3.3.2
error: build of '/nix/store/24knxq6n5744r9922qp55dhw77035031-VirtualBox-6.0.4-128414-OSX.dmg.drv', '/nix/store/6wm36yvhnkc3zyz3jrnq2rj6rprx882i-undmg-1.0.3.drv', '/nix/store/b3vyrfzarzyh51n7fj9wrpw12sq3765l-stdenv-darwin.drv' failed