home-manager icon indicating copy to clipboard operation
home-manager copied to clipboard

bug: mkdir fails with 'Operation not permitted' for some pkgs during installPhase

Open MSDimos opened this issue 9 months ago • 3 comments

Are you following the right branch?

  • [x] My Nixpkgs and Home Manager versions are in sync

Is there an existing issue for this?

  • [x] I have searched the existing issues

Issue description

What happened to me?

I can't switch home-manager generation anymore.

I use home-manager to install vscode like home.packages = [ pkgs.vscode ];, a day before, it works fine, but today everything is broken.

My command's execution result:

$ nix run home-manager/master -- switch --flake .--impure
/* some log msg not important */
error: builder for '/nix/store/qlzsz9j20dgv4mw778gjpg6rbr9ad9ml-vscode-1.97.2.drv' failed with exit code 1;
       last 9 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/7rki4hbfvg9z1c1pcq30mlcj0yihkaw6-VSCode_1.97.2_darwin-arm64.zip
       > source root is Visual Studio Code.app
       > setting SOURCE_DATE_EPOCH to timestamp 1739435512 of file "Visual
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: glibPreInstallPhase
       > Running phase: installPhase
       > mkdir: cannot create directory '/nix/store/y4xz7f5qwnamnlwcn6jydds71c1r99va-vscode-1.97.2/Applications/Visual Studio Code.app': Operation not permitted
       For full logs, run:
         nix log /nix/store/qlzsz9j20dgv4mw778gjpg6rbr9ad9ml-vscode-1.97.2.drv
error: 1 dependencies of derivation '/nix/store/2q1mcszy8yy4xi898267855j69yvhi5f-home-manager-applications.drv' failed to build
error: 1 dependencies of derivation '/nix/store/83kxjvjj3aznrjx66gz3qpw7wx5k3wla-home-manager-fonts.drv' failed to build
error: 1 dependencies of derivation '/nix/store/4wgf51r2mw6mr6jsi6piqdd7f86lcpw9-home-manager-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/8lcmwjjjm7pgih0m5qh0iqg3jpsvbdwr-home-manager-generation.drv' failed to build

I have checked the permission of related directories, like below:

$ ls -la /nix/store/ -g | grep "vscode-1.97.2"
drwxr-xr-x      - _nixbld1 nixbld  2 Feb 13:35  y4xz7f5qwnamnlwcn6jydds71c1r99va-vscode-1.97.2

What did I do before?

I uninstalled the nix followed by this tutorial and reinstall it using nix-installer.

Something weired

I googled this same issue, but this unlucky guy like me is using nix-darwin. I followed what they did like:

home.packages = [
  vscode = pkgs.vscode.overrideAttrs (old: {
    installPhase = "whoami\n" + old.installPhase;
  });
];

It's okay now. But I can't understand it.

Maintainer CC

No response

System information

- system: `"aarch64-darwin"`
 - host os: `Darwin 24.4.0, macOS 15.4`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.26.2`
 - nixpkgs: `/nix/store/4yng3wz3ri8q2g64aysa72j1n3dsa0i2-source`

MSDimos avatar Feb 26 '25 04:02 MSDimos

Hi, I have same issue.

I uninstalled the nix followed by this tutorial and reinstall it using nix-installer.

I also uninstalled nix, and reinstalled it by official method. https://nixos.org/download/

My system version is here.

- system: `"aarch64-darwin"`
 - host os: `Darwin 24.3.0, macOS 15.3`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.26.3`
 - home-manager version 25.05-pre

terassyi avatar Mar 13 '25 00:03 terassyi

Hi, I have same issue.

I uninstalled the nix followed by this tutorial and reinstall it using nix-installer.

I also uninstalled nix, and reinstalled it by official method. https://nixos.org/download/

My system version is here.

- system: `"aarch64-darwin"`
 - host os: `Darwin 24.3.0, macOS 15.3`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.26.3`
 - home-manager version 25.05-pre

Check this answer, this helps me resolve my problem. I don't know the reason, but it actually works. 🥲

MSDimos avatar Mar 13 '25 06:03 MSDimos

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

  • If this is resolved, please consider closing it so that the maintainers know not to focus on this.
  • If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
If you are not the original author of the issue

  • If you are also experiencing this issue, please add details of your situation to help with the debugging process.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

stale[bot] avatar Jun 11 '25 23:06 stale[bot]