NixOS / bundlers

MIT License
97 stars 13 forks source link

darwin bundlers do not work #7

Open colin-arnott-xero opened 1 year ago

colin-arnott-xero commented 1 year ago

x86_64-darwin and aarch64-darwin are listed as "supportedSystems", but the following error is returned:

https://github.com/NixOS/bundlers/blob/b11f6a6b4d96ad424dc927fa211d1a1ac50179ef/flake.nix#L15

$ nix bundle --bundler github:NixOS/bundlers nixpkgs#hello
error: Package ‘nix-user-chroot-2c52b5f’ in /nix/store/1rc10ydlf4c2aphrg2z2dxaaikbggba0-source/default.nix:49 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)

reading the upstream documentation for the tool this was based upon, it seems this is expected, just not documented here?

similarly, toDockerImage succeeds, but packs a mach-o binary into into a docker image: (nixpkgs#pkgsCross.musl64.hello works as expected)

$ nix bundle --bundler github:NixOS/bundlers#toDockerImage nixpkgs#hello --verbose
$ docker load < hello-2.12.1.tar.gz
78fcfc116447: Loading layer [==================================================>]  655.4kB/655.4kB
0d5cb48ad5d9: Loading layer [==================================================>]  1.085MB/1.085MB
88746dbbf806: Loading layer [==================================================>]  112.6kB/112.6kB
37ac77f97851: Loading layer [==================================================>]   2.14MB/2.14MB
c186ef70529c: Loading layer [==================================================>]  19.51MB/19.51MB
7b033f88ff6d: Loading layer [==================================================>]  4.833MB/4.833MB
881c3383a4c5: Loading layer [==================================================>]  1.208MB/1.208MB
770296159cae: Loading layer [==================================================>]  1.884MB/1.884MB
f40b9120a89c: Loading layer [==================================================>]  1.976MB/1.976MB
dee763386703: Loading layer [==================================================>]  153.6kB/153.6kB
a75b5721a144: Loading layer [==================================================>]  1.741MB/1.741MB
b6c1c599d6d2: Loading layer [==================================================>]  245.8kB/245.8kB
962272f441a3: Loading layer [==================================================>]  184.3kB/184.3kB
a2136da04750: Loading layer [==================================================>]  1.106MB/1.106MB
bad5e5760d0b: Loading layer [==================================================>]   42.4MB/42.4MB
384935350f01: Loading layer [==================================================>]  614.4kB/614.4kB
585453de14b2: Loading layer [==================================================>]  1.372MB/1.372MB
cf30a0d06dfa: Loading layer [==================================================>]  3.666MB/3.666MB
065694f29ee1: Loading layer [==================================================>]  81.92kB/81.92kB
1ab22814d143: Loading layer [==================================================>]  10.24kB/10.24kB
Loaded image: hello-2.12.1:latest
$ docker run hello-2.12.1:latest hello
exec /bin/hello: exec format error

this will be made moot if #2 is fixed.

nixos-discourse commented 1 year ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nix-bundle-on-darwin/24481/2