devcontainers / features

A collection of Dev Container Features managed by Dev Container spec maintainers. See https://github.com/devcontainers/feature-starter to publish your own
https://containers.dev/features
MIT License
938 stars 382 forks source link

Nix post-installation script failing #1093

Open liamjones-pw opened 3 months ago

liamjones-pw commented 3 months ago
{
    "name": "Ubuntu",
    "image": "mcr.microsoft.com/devcontainers/base:jammy", // also tested noble
    "features": {
        "ghcr.io/devcontainers/features/nix:1": {
            "version": "latest",
            "packages": "age"
        }
    }
}

Running a devcontainer with this config on MacOS Sonoma 14.5 and VSCode 1.92.1 results in the following failure.

Output

``` ... 32.29 Alright! We're done! 32.29 Try it! Open a new terminal, and type: 32.29 $ sudo nix-daemon 32.29 $ nix-shell -p nix-info --run "nix-info -m" 32.29 32.29 Thank you for using this installer. If you have any feedback or need 32.29 help, don't hesitate: 32.29 32.29 You can open an issue at 32.29 https://github.com/NixOS/nix/issues/new?labels=installer&template=installer.md 32.29 32.29 Or get in touch with the community: https://nixos.org/community 32.29 32.29 ---- Reminders ----------------------------------------------------------------- 32.29 [ 1 ] 32.29 Nix won't work in active shell sessions until you restart them. 32.29 32.29 [ 2 ] 32.29 I don't support your init system yet; you may want to add nix-daemon manually. 32.29 32.32 (*) Setting up entrypoint... 32.33 (*) Executing post-installation steps... 32.33 Installing packages "age" in profile... 33.10 evaluation warning: The package set `androidndkPkgs_23b` has been renamed to `androidndkPkgs_23`. 34.43 evaluation warning: cinnamon.bulky was moved to top-level. Please use pkgs.bulky directly. 34.43 evaluation warning: cinnamon.cinnamon-common was moved to top-level. Please use pkgs.cinnamon-common directly. 34.43 evaluation warning: cinnamon.cinnamon-control-center was moved to top-level. Please use pkgs.cinnamon-control-center directly. 34.43 evaluation warning: cinnamon.cinnamon-desktop was moved to top-level. Please use pkgs.cinnamon-desktop directly. 34.43 evaluation warning: cinnamon.cinnamon-gsettings-overrides was moved to top-level. Please use pkgs.cinnamon-gsettings-overrides directly. 34.43 evaluation warning: cinnamon.cinnamon-menus was moved to top-level. Please use pkgs.cinnamon-menus directly. 34.43 evaluation warning: cinnamon.cinnamon-screensaver was moved to top-level. Please use pkgs.cinnamon-screensaver directly. 34.43 evaluation warning: cinnamon.cinnamon-session was moved to top-level. Please use pkgs.cinnamon-session directly. 34.43 evaluation warning: cinnamon.cinnamon-settings-daemon was moved to top-level. Please use pkgs.cinnamon-settings-daemon directly. 34.43 evaluation warning: cinnamon.cinnamon-translations was moved to top-level. Please use pkgs.cinnamon-translations directly. 34.43 evaluation warning: cinnamon.cjs was moved to top-level. Please use pkgs.cjs directly. 34.43 evaluation warning: cinnamon.folder-color-switcher was moved to top-level. Please use pkgs.folder-color-switcher directly. 34.43 evaluation warning: cinnamon.iso-flags-png-320x420 was moved to top-level and renamed to pkgs.iso-flags-png-320x240. 34.43 evaluation warning: cinnamon.mint-artwork was moved to top-level. Please use pkgs.mint-artwork directly. 34.43 evaluation warning: cinnamon.mint-cursor-themes was moved to top-level. Please use pkgs.mint-cursor-themes directly. 34.43 evaluation warning: cinnamon.mint-l-icons was moved to top-level. Please use pkgs.mint-l-icons directly. 34.43 evaluation warning: cinnamon.mint-l-theme was moved to top-level. Please use pkgs.mint-l-theme directly. 34.43 evaluation warning: cinnamon.mint-themes was moved to top-level. Please use pkgs.mint-themes directly. 34.43 evaluation warning: cinnamon.mint-x-icons was moved to top-level. Please use pkgs.mint-x-icons directly. 34.43 evaluation warning: cinnamon.mint-y-icons was moved to top-level. Please use pkgs.mint-y-icons directly. 34.43 evaluation warning: cinnamon.muffin was moved to top-level. Please use pkgs.muffin directly. 34.43 evaluation warning: cinnamon.nemo was moved to top-level. Please use pkgs.nemo directly. 34.43 evaluation warning: cinnamon.nemo-emblems was moved to top-level. Please use pkgs.nemo-emblems directly. 34.43 evaluation warning: cinnamon.nemo-fileroller was moved to top-level. Please use pkgs.nemo-fileroller directly. 34.43 evaluation warning: cinnamon.nemo-python was moved to top-level. Please use pkgs.nemo-python directly. 34.43 evaluation warning: cinnamon.nemo-with-extensions was moved to top-level. Please use pkgs.nemo-with-extensions directly. 34.43 evaluation warning: cinnamon.pix was moved to top-level. Please use pkgs.pix directly. 34.43 evaluation warning: cinnamon.warpinator was moved to top-level. Please use pkgs.warpinator directly. 34.43 evaluation warning: cinnamon.xapp was moved to top-level. Please use pkgs.xapp directly. 34.43 evaluation warning: cinnamon.xapps was moved to top-level and renamed to pkgs.xapp. 34.43 evaluation warning: cinnamon.xreader was moved to top-level. Please use pkgs.xreader directly. 34.43 evaluation warning: cinnamon.xviewer was moved to top-level. Please use pkgs.xviewer directly. 36.95 evaluation warning: eww now can build for X11 and wayland simultaneously, so `eww-wayland` is deprecated, use the normal `eww` package instead. 37.38 evaluation warning: 'glew-egl' is now provided by 'glew' directly 37.41 evaluation warning: The ‘gnome.accerciser’ was moved to top-level. Please use ‘pkgs.accerciser’ directly. 37.41 evaluation warning: The ‘gnome.adwaita-icon-theme’ was moved to top-level. Please use ‘pkgs.adwaita-icon-theme’ directly. 37.41 evaluation warning: The ‘gnome.baobab’ was moved to top-level. Please use ‘pkgs.baobab’ directly. 37.41 evaluation warning: The ‘gnome.cheese’ was moved to top-level. Please use ‘pkgs.cheese’ directly. 37.41 evaluation warning: The ‘gnome.dconf-editor’ was moved to top-level. Please use ‘pkgs.dconf-editor’ directly. 37.41 evaluation warning: The ‘gnome.devhelp’ was moved to top-level. Please use ‘pkgs.devhelp’ directly. 37.41 evaluation warning: The ‘gnome.eog’ was moved to top-level. Please use ‘pkgs.eog’ directly. 37.41 evaluation warning: The ‘gnome.epiphany’ was moved to top-level. Please use ‘pkgs.epiphany’ directly. 37.41 evaluation warning: The ‘gnome.evince’ was moved to top-level. Please use ‘pkgs.evince’ directly. 37.41 evaluation warning: The ‘gnome.evolution-data-server’ was moved to top-level. Please use ‘pkgs.evolution-data-server’ directly. 37.41 evaluation warning: The ‘gnome.file-roller’ was moved to top-level. Please use ‘pkgs.file-roller’ directly. 37.41 evaluation warning: The ‘gnome.geary’ was moved to top-level. Please use ‘pkgs.geary’ directly. 37.41 evaluation warning: The ‘gnome.ghex’ was moved to top-level. Please use ‘pkgs.ghex’ directly. 37.41 evaluation warning: The ‘gnome.gitg’ was moved to top-level. Please use ‘pkgs.gitg’ directly. 37.41 evaluation warning: The ‘gnome.gnome-autoar’ was moved to top-level. Please use ‘pkgs.gnome-autoar’ directly. 37.42 evaluation warning: The ‘gnome.gnome-calculator’ was moved to top-level. Please use ‘pkgs.gnome-calculator’ directly. 37.42 evaluation warning: The ‘gnome.gnome-calendar’ was moved to top-level. Please use ‘pkgs.gnome-calendar’ directly. 37.42 evaluation warning: The ‘gnome.gnome-common’ was moved to top-level. Please use ‘pkgs.gnome-common’ directly. 37.42 evaluation warning: The ‘gnome.gnome-dictionary’ was moved to top-level. Please use ‘pkgs.gnome-dictionary’ directly. 37.42 evaluation warning: The ‘gnome.gnome-disk-utility’ was moved to top-level. Please use ‘pkgs.gnome-disk-utility’ directly. 37.42 evaluation warning: The ‘gnome.gnome-font-viewer’ was moved to top-level. Please use ‘pkgs.gnome-font-viewer’ directly. 37.42 evaluation warning: The ‘gnome.gnome-keyring’ was moved to top-level. Please use ‘pkgs.gnome-keyring’ directly. 37.42 evaluation warning: The ‘gnome.gnome-packagekit’ was moved to top-level. Please use ‘pkgs.gnome-packagekit’ directly. 37.42 evaluation warning: The ‘gnome.gnome-screenshot’ was moved to top-level. Please use ‘pkgs.gnome-screenshot’ directly. 37.43 evaluation warning: The ‘gnome.gnome-system-monitor’ was moved to top-level. Please use ‘pkgs.gnome-system-monitor’ directly. 37.43 evaluation warning: The ‘gnome.gnome-terminal’ was moved to top-level. Please use ‘pkgs.gnome-terminal’ directly. 37.43 evaluation warning: The ‘gnome.gnome-themes-extra’ was moved to top-level. Please use ‘pkgs.gnome-themes-extra’ directly. 37.43 evaluation warning: The ‘gnome.gnome-tweaks’ was moved to top-level. Please use ‘pkgs.gnome-tweaks’ directly. 37.43 evaluation warning: The ‘gnome.gnome-user-share’ was moved to top-level. Please use ‘pkgs.gnome-user-share’ directly. 37.43 evaluation warning: The ‘gnome.gpaste’ was moved to top-level. Please use ‘pkgs.gpaste’ directly. 37.43 evaluation warning: The ‘gnome.gucharmap’ was moved to top-level. Please use ‘pkgs.gucharmap’ directly. 37.43 evaluation warning: The ‘gnome.libgnome-keyring’ was moved to top-level. Please use ‘pkgs.libgnome-keyring’ directly. 37.43 evaluation warning: The ‘gnome.nautilus’ was moved to top-level. Please use ‘pkgs.nautilus’ directly. 37.43 evaluation warning: The ‘gnome.nautilus-python’ was moved to top-level. Please use ‘pkgs.nautilus-python’ directly. 37.44 evaluation warning: The ‘gnome.pomodoro’ was moved to top-level. Please use ‘pkgs.gnome-pomodoro’ directly. 37.44 evaluation warning: The ‘gnome.rygel’ was moved to top-level. Please use ‘pkgs.rygel’ directly. 37.44 evaluation warning: The ‘gnome.seahorse’ was moved to top-level. Please use ‘pkgs.seahorse’ directly. 37.44 evaluation warning: The ‘gnome.simple-scan’ was moved to top-level. Please use ‘pkgs.simple-scan’ directly. 37.44 evaluation warning: The ‘gnome.sushi’ was moved to top-level. Please use ‘pkgs.sushi’ directly. 37.44 evaluation warning: The ‘gnome.totem’ was moved to top-level. Please use ‘pkgs.totem’ directly. 37.44 evaluation warning: The ‘gnome.yelp’ was moved to top-level. Please use ‘pkgs.yelp’ directly. 37.44 evaluation warning: The ‘gnome.yelp-xsl’ was moved to top-level. Please use ‘pkgs.yelp-xsl’ directly. 37.44 evaluation warning: The ‘gnome.zenity’ was moved to top-level. Please use ‘pkgs.zenity’ directly. 46.56 /tmp/dev-container-features/nix_0/post-install-steps.sh: line 28: 1450 Killed nix-env --install ${PACKAGES} 46.56 ERROR: Feature "Nix Package Manager" (ghcr.io/devcontainers/features/nix) failed to install! Look at the documentation at https://github.com/devcontainers/features/tree/main/src/nix for help troubleshooting this error. ------ Dockerfile.extended:24 -------------------- 23 | ENV PATH="/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:${PATH}" 24 | >>> RUN --mount=type=bind,from=dev_containers_feature_content_source,source=nix_0,target=/tmp/build-features-src/nix_0 \ 25 | >>> cp -ar /tmp/build-features-src/nix_0 /tmp/dev-container-features \ 26 | >>> && chmod -R 0755 /tmp/dev-container-features/nix_0 \ 27 | >>> && cd /tmp/dev-container-features/nix_0 \ 28 | >>> && chmod +x ./devcontainer-features-install.sh \ 29 | >>> && ./devcontainer-features-install.sh \ 30 | >>> && rm -rf /tmp/dev-container-features/nix_0 31 | -------------------- ERROR: failed to solve: process "/bin/sh -c cp -ar /tmp/build-features-src/nix_0 /tmp/dev-container-features && chmod -R 0755 /tmp/dev-container-features/nix_0 && cd /tmp/dev-container-features/nix_0 && chmod +x ./devcontainer-features-install.sh && ./devcontainer-features-install.sh && rm -rf /tmp/dev-container-features/nix_0" did not complete successfully: exit code: 137 ... ```

I can build the container without any packages successfully.

Running nix-env --install age directly results in the error. Running nix-env -iA nixpkgs.age directly installs successfully.

Using the useAttributePath option with package age is successful. Using the useAttributePath option with package nixpkgs.age is successful.

I'm relatively new to nix so maybe there's something obvious I'm missing, but if the current error with nix-env --install is expected, it might be more intuitive to have useAttributePath on by default?

samruddhikhandale commented 2 months ago

@gauravsaini04 / @prathameshzarkar9 Can you help investigate this? Thanks!

samruddhikhandale commented 2 months ago

Hi @liamjones-pw 👋

The commands nix-env --install ${PACKAGES} and nix-env -iA ${PACKAGES} are used to install packages in Nix, but they have different behaviors and use cases.

nix-env --install ${PACKAGES}

nix-env -iA ${PACKAGES}

That said, I agree that setting useAttributePath:true by default would be optimal. However, I’m concerned this could be a breaking change for users. We’ll need to release a new v2.0.0 for the nix Feature.

Let's wait for more user feedback and upvotes before making this change. Thanks for your patience!

In the meantime, could you unblock yourselves with the following? 👇 Thanks!

{
    "name": "Ubuntu",
    "image": "mcr.microsoft.com/devcontainers/base:jammy", // also tested noble
    "features": {
        "ghcr.io/devcontainers/features/nix:1": {
            "version": "latest",
            "packages": "age",
            "useAttributePath": true
        }
    }
}
liamjones-pw commented 2 months ago

@samruddhikhandale thanks for your detailed reply.