NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.37k stars 13.59k forks source link

distrobox: does not support macOS (Darwin) #241720

Closed osalbahr closed 1 year ago

osalbahr commented 1 year ago

Describe the bug

Distrobox does not work on macOS.

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix-shell -p distrobox
  2. distrobox enter

Expected behavior

A distrobox is created and entered.

Screenshots

  1. nix-shell -p distrobox
    
    dracula@REDACTED ~ % nix-shell -p distrobox

[nix-shell:~]$ distrobox enter Missing dependency: we need a container manager. Please install one of podman or docker. You can follow the documentation on: man distrobox-compatibility or: https://github.com/89luca89/distrobox/blob/main/docs/compatibility.md

2. `nix-shell -p distrobox podman`
```console
dracula@REDACTED ~ % nix-shell -p distrobox podman

[nix-shell:~]$ distrobox enter
Error: inspecting object: no such container "my-distrobox"
Cannot find container my-distrobox
Create it now, out of image registry.fedoraproject.org/fedora-toolbox:38? [Y/n]: y
Creating the container with command:
  /nix/store/fnq0wrsgzz354xg4sxfnp4hg70pbl81q-distrobox-1.5.0.2/bin/distrobox-create -i registry.fedoraproject.org/fedora-toolbox:38 -n my-distrobox
Creating 'my-distrobox' using image registry.fedoraproject.org/fedora-toolbox:3Error: statfs /nix/store/fnq0wrsgzz354xg4sxfnp4hg70pbl81q-distrobox-1.5.0.2/bin/distrobox-init: no such file or directory
 [ ERR ]
Container my-distrobox is not running.
Starting container my-distrobox
run this command to follow along:

 podman logs -f my-distrobox

Error: no container with name or ID "my-distrobox" found: no such container

[nix-shell:~]$ podman logs -f my-distrobox
Error: no container with name or ID "my-distrobox" found: no such container

3, nix-shell -p distrobox docker

dracula@REDACTED ~ % nix-shell -p distrobox docker

[nix-shell:~]$ distrobox enter
Error: No such container: my-distrobox
Cannot find container my-distrobox
Create it now, out of image registry.fedoraproject.org/fedora-toolbox:38? [Y/n]: 
Creating the container with command:
  /nix/store/fnq0wrsgzz354xg4sxfnp4hg70pbl81q-distrobox-1.5.0.2/bin/distrobox-create -i registry.fedoraproject.org/fedora-toolbox:38 -n my-distrobox
Creating 'my-distrobox' using image registry.fedoraproject.org/fedora-toolbox:3Error response from daemon: make cli opts(): making volume mountpoint for volume /nix/store/fnq0wrsgzz354xg4sxfnp4hg70pbl81q-distrobox-1.5.0.2/bin/distrobox-export: mkdir /nix: operation not permitted
 [ ERR ]
Container my-distrobox is not running.
Starting container my-distrobox
run this command to follow along:

 docker logs -f my-distrobox

Error response from daemon: no container with name or ID "my-distrobox" found: no such container
Error: failed to start containers: my-distrobox

[nix-shell:~]$ docker logs -f my-distrobox
Error: No such container: my-distrobox

Additional context

The upstream does not support macOS (Darwin) 89luca89/distrobox#36: [Feature] MacOS host support. I'm not sure why https://search.nixos.org/packages?show=distrobox displays x86_64-darwin (and aarch64-darwin) under Platforms.

Notify maintainers

@AtilaSaraiva @r-ryantm

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

dracula@REDACTED ~ % nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-darwin"`
 - host os: `Darwin 22.5.0, macOS 10.16`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.16.1`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Note: I'm actually not on macOS 10.16 but running the latest, macOS Ventura 13.4.1.

dracula@REDACTED ~ % nix-shell -p hyfetch                     

[nix-shell:~]$ neowofetch
                    c.'          dracula@Osamas-MacBook-Pro 
                 ,xNMM.          -------------------------- 
               .OMMMMo           OS: macOS Ventura 13.4.1 (22F82) x86_64 
               lMM"              Host: MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports) 
     .;loddo:.  .olloddol;.      Kernel: 22.5.0 
   cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 11 hours, 32 mins 
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Shell: bash 5.2.15 
 XMMMMMMMMMMMMMMMMMMMMMMMX.      Resolution: 2560x1600 
;MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua () 
:MMMMMMMMMMMMMMMMMMMMMMMM:       WM: Quartz Compositor 
.MMMMMMMMMMMMMMMMMMMMMMMMX.      WM Theme: Blue (Dark) 
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.    Terminal: Apple_Terminal 
 'XMMMMMMMMMMMMMMMMMMMMMMMMMMk   Terminal Font: SFMono-Regular 11 
  'XMMMMMMMMMMMMMMMMMMMMMMMMK.   CPU: Intel i5-7360U (4) @ 2.30GHz 
    kMMMMMMMMMMMMMMMMMMMMMMd     GPU: Intel Iris Plus Graphics 640 
     ;KMMMMMMMWXXWMMMMMMMk.      Memory: 6798.67 MiB / 8192.00 MiB 
       "cooc*"    "*coo'"
Screenshot 2023-07-05 at 1 09 16 PM

Related issue: nixpkgs podman and qemu on darwin don't play well together #169118

MichaelPachec0 commented 1 year ago

It shows as compatible because the derivation states that it is.

https://github.com/NixOS/nixpkgs/blob/098659cc0c9481747c5608918a9c5001d976b072/pkgs/applications/virtualization/distrobox/default.nix#L44

It would be a pretty easy fix to not show up as compatible with darwin targets. My question is since the expected behavior you mention is not what upstream currently supports, what it would take to close this issue? Would marking this package as not compatible (which would close the issue) until upstream supports darwin (at which point a new issue is created) targets be enough? or something else?

osalbahr commented 1 year ago

It shows as compatible because the derivation states that it is.

Oh, ok. Thank you for clarifying. I’m new to nix so I don’t know how derivations work.

https://github.com/NixOS/nixpkgs/blob/098659cc0c9481747c5608918a9c5001d976b072/pkgs/applications/virtualization/distrobox/default.nix#L44

It would be a pretty easy fix to not show up as compatible with darwin targets. My question is since the expected behavior you mention is not what upstream currently supports, what it would take to close this issue? Would marking this package as not compatible until upstream supports darwin targets be enough? or something else?

Not sure what the proper action is tbh. I am reporting how I interpreted the page. I thought nix somehow made distrobox work on macOS but then it didn’t so I opened an issue. How is compatibility usually determined in nixpkgs?

MichaelPachec0 commented 1 year ago

Not sure what the proper action is tbh. I am reporting how I interpreted the page. I thought nix somehow made distrobox work on macOS but then it didn’t so I opened an issue. How is compatibility usually determined in nixpkgs?

Nix does not auto-magically do this. nix on darwin runs directly on darwin (as I understand) so if upstream does not support it, it is very likely the case that packages installed by nix on darwin wont either. This is still a valid issue, since upstream does not support darwin yet the derivation shows that it does.

osalbahr commented 1 year ago

Should be fixed by #242143.