# IDX Environment Broken - Nix and idx Command Not Working - New Workspace

**URL:** <https://community.firebasestudio.dev/t/idx-environment-broken-nix-and-idx-command-not-working-new-workspace/9337>\
**Category:** General\
**Created:** [February 13, 2025, 6:27am UTC](https://community.firebasestudio.dev/t/idx-environment-broken-nix-and-idx-command-not-working-new-workspace/9337 "2025-02-13T06:27:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BenjaminHD](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/benjaminhd/32/4305_2.png) [@BenjaminHD](https://community.firebasestudio.dev/u/BenjaminHD)\
**Post date:** [February 13, 2025, 6:27am UTC](https://community.firebasestudio.dev/t/idx-environment-broken-nix-and-idx-command-not-working-new-workspace/9337/1 "2025-02-13T06:27:03Z")

</div>

I am experiencing a critical issue with Google Cloud IDX that is completely preventing me from developing my project. The Nix environment within IDX is not initializing correctly, resulting in the following problems:

- **HOME Environment Variable Incorrect:** The HOME environment variable is incorrectly set to /root instead of /home/user. This causes problems with package installation and environment configuration.

- **idx Command Not Found:** The idx command-line tool is not available within the IDX terminal (bash: idx: command not found). This prevents me from rebuilding the environment using idx restart.

- **Linker (ld) Not Found:** The C/C++ linker (ld) is not found, even when the dev.nix file includes the necessary pkgs.gcc package. This prevents me from building software that requires linking (specifically, PJSIP).

These issues persist even after creating multiple new workspaces and trying different project templates. This is clearly not a user-side configuration error, but a fundamental problem with the IDX environment itself.

**Steps to Reproduce (Minimal Example):**

1. Create a new IDX workspace using the “Python Flask” template.

2. Replace the contents of .idx/dev.nix with the following:

{ pkgs, … }: {  
channel = “stable-24.05”;  
packages = [  
pkgs.gcc  
pkgs.git  
];  
}

1. Attempt to rebuild the workspace using idx restart in the terminal.

2. Observe that the idx command is not found.

3. Open a new terminal and run the following commands:

echo $HOME  
ld --version

1. Observe that echo $HOME outputs /root (incorrect) and ld --version fails with “ld is not installed…”.

**Expected Result:**

- The idx command should be available and rebuild the environment.

- echo $HOME should output /home/user.

- ld --version should show the linker version information.

**Actual Result:**

- idx command is not found.

- HOME is set to /root.

- ld is not found.

**Troubleshooting Steps Already Taken:**

I have already tried all of the following without success:

- Created multiple new IDX workspaces (at least 5).
- Used different project templates (“Blank”, “Python Flask”).
- Explicitly set HOME = “/home/user”; in dev.nix.
- Attempted to use idx restart to rebuild (but the command is not found).
- Cleared browser cache and cookies.
- Tried a different browser (Chrome and Firefox).
- Tried an incognito/private window.
- Verified my IAM roles (Owner and Cloud Workstations Admin).
- Attempted to source the Nix profile manually (but the file /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh does not exist).
- Searched for the idx executable using find (not found).

**Impact:**

This issue is a complete blocker for my development work. I am unable to build the necessary software (PJSIP) or manage my environment within IDX. I cannot proceed with my project.

**Request:**

I request urgent assistance in resolving this issue. Due to the persistence of the problem across multiple workspaces and after extensive troubleshooting, this clearly requires escalation to an engineer familiar with the Google Cloud IDX platform and its Nix environment configuration. Please provide a solution as soon as possible.

**Attachments:**

{ pkgs, … }: {  
channel = “stable-24.05”;  
packages = [  
pkgs.gcc # Correct way to get the C/C++ compiler and linker  
pkgs.git  
pkgs.python311  
pkgs.python311Packages.pip  
pkgs.openssl # For SSL/TLS support in PJSIP  
pkgs.alsaLib # For audio  
pkgs.libpulseaudio # For audio  
pkgs.libuuid # Required by PJSIP  
pkgs.libsndfile # For audio file handling  
pkgs.pkgconfig # Essential for finding libraries  
pkgs.SDL2 # For multimedia (optional, but good to have)  
pkgs.ffmpeg # For audio/video codecs  
pkgs.srtp #For secure media  
pkgs.libyuv #hHandles color space  
pkgs.webrtc #Echo cancellation  
# Add any other PJSIP codecs here (if needed)  
];

env = {  
HOME = “/home/user”; # Explicitly set HOME to avoid permission issues  
# You can add other NON-SENSITIVE environment variables here if needed  
};

idx = {  
extensions = [  
“ms-python.python” # Essential Python extension for VS Code  
];  
previews = { enable = true; }; # Enable web previews (not directly used, but harmless)  
workspace = {  
onCreate = {  
# Install requests and elevenlabs using pip _within the Nix environment_  
install-python-packages = ‘’  
${pkgs.python311}/bin/python3 -m pip install requests elevenlabs  
‘’;  
};  
onStart = {  
# Intentionally left blank. We don’t want any automatic startup commands.  
};  
};  
};  
}

---

<div class="post-metadata">

**Author:** ![kirupa](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/kirupa/32/4_2.png) [@kirupa](https://community.firebasestudio.dev/u/kirupa)\
**Post date:** [February 13, 2025, 11:45pm UTC](https://community.firebasestudio.dev/t/idx-environment-broken-nix-and-idx-command-not-working-new-workspace/9337/4 "2025-02-13T23:45:03Z")

</div>

Thanks for the detailed response, @BenjaminHD. We’ll take a look. Pinging @Vova in case he sees something obvious that I am missing.

---

<div class="post-metadata">

**Author:** ![Alex](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/alex/32/218_2.png) [@Alex](https://community.firebasestudio.dev/u/Alex)\
**Post date:** [February 13, 2025, 11:52pm UTC](https://community.firebasestudio.dev/t/idx-environment-broken-nix-and-idx-command-not-working-new-workspace/9337/5 "2025-02-13T23:52:15Z")

</div>

Hey thanks for the report. I can’t seem to repro the issue though(screenshot attached), $HOME should be set to /home/user.

 ![Screenshot 2025-02-13 at 6.50.27 PM](https://us1.discourse-cdn.com/flex002/uploads/idxcommunity/original/2X/6/6bba4931bc4c2de231b380dc5965b7cd9d576b0c.png)

Also curious, what is the idx command that you mentioned. Was this documented somewhere?

---

<div class="post-metadata">

**Author:** ![Shin18](https://sea2.discourse-cdn.com/flex002/user_avatar/community.firebasestudio.dev/shin18/32/6231_2.png) [@Shin18](https://community.firebasestudio.dev/u/Shin18)\
**Post date:** [May 11, 2025, 6:40pm UTC](https://community.firebasestudio.dev/t/idx-environment-broken-nix-and-idx-command-not-working-new-workspace/9337/6 "2025-05-11T18:40:28Z")

</div>

> [@BenjaminHD](#):
>
> pkgs.git

I’m having the same issue. rebuild environment isn’t working

# .idx/dev.nix — compliant with Firebase Studio’s reference

{ pkgs, … }: {

# 1. Channel (must be one of the allowed values)

channel = “stable-24.05”; # ✅ allowed per schema :contentReference[oaicite:13]{index=13}

# 2. Packages (list of derivations, no typos)

packages = [  
pkgs.python311 # Python 3.11 interpreter :contentReference[oaicite:14]{index=14}  
pkgs.python311Packages.pip # pip package manager  
pkgs.python311Packages.virtualenv # virtualenv module :contentReference[oaicite:15]{index=15}  
pkgs.python311Packages.jupyterlab # JupyterLab interface :contentReference[oaicite:16]{index=16}  
pkgs.python311Packages.ipykernel # IPython kernel for Jupyter :contentReference[oaicite:17]{index=17}  
pkgs.stdenv.cc.cc.lib # C++ runtime (libstdc++.so.6) :contentReference[oaicite:18]{index=18}  
pkgs.git  
];

# 3. Environment variables

env = {  
# Provide the dynamic linker path for native modules  
LD\_LIBRARY\_PATH = “${pkgs.stdenv.cc.cc.lib}/lib”; # string or list allowed :contentReference[oaicite:19]{index=19}  
};

# 4. Editor extensions (Open VSX IDs)

idx.extensions = [  
“vscodevim.vim”  
“ms-python.python”  
“ms-python.vscode-pylance”  
“ms-toolsai.jupyter”  
“GitHub.vscode-pull-request-github”  
]; # list of non-empty strings :contentReference[oaicite:20]{index=20}

# 5. (Optional) Previews — enable live reload feature

idx.previews = {  
enable = true; # boolean :contentReference[oaicite:21]{index=21}  
previews = { }; # no custom previews defined, still valid :contentReference[oaicite:22]{index=22}  
};

# 6. Workspace lifecycle hooks

idx.workspace.onCreate = {  
install-deps = “pip install -r requirements.txt”; # runs on first open :contentReference[oaicite:23]{index=23}  
};  
idx.workspace.onStart = {  
# define commands to run on subsequent workspace starts, if needed  
};  
}
