Skip to content

Instantly share code, notes, and snippets.

@Tc-001
Last active October 4, 2025 16:38
Show Gist options
  • Select an option

  • Save Tc-001/00072309490c90f14a032c1d88718803 to your computer and use it in GitHub Desktop.

Select an option

Save Tc-001/00072309490c90f14a032c1d88718803 to your computer and use it in GitHub Desktop.
How to "escape" nixos FHS sandbox for vscode

So, I needed to use the 1password CLI from vscode-fhs, but it didn't work because the sandbox user wasn't the same as the native one.

tc001 ~/foo> op whoami                                                                     
[ERROR] connecting to desktop app: read: connection reset, make sure 1Password CLI is installed correctly, then open the 1Password app, select 1Password > Settings > Developer and make sure the 'Integrate with 1Password CLI' setting is turned on. If you're still having trouble connecting, restart the app.

Thankfully this was pretty easy to solve once I figured it out, but it wasn't really doccumented anywhere.

su doesn't work, even if I set a non root user (setuid binaries are restricted), but run0/systemd-run does!

So all you need to do is create a new shell profile that spawns fish with systemd-run in your user settings:

  "terminal.integrated.profiles.linux": {
    // ...
    "fish-fhs": {
      "path": "systemd-run",
      "args": [
        "--user",
        "--pty",
        "--quiet",
        "--same-dir",
        "--service-type=exec",
        "fish"
      ]
    }
  },

...and optinally set it as the default one!

  "terminal.integrated.defaultProfile.linux": "fish-fhs"

(you can replace fish with your shell of choice)

And it magically starts to work!

tc001 ~/foo> op whoami   
URL:        https://my.1password.eu/
Email:      xxxxxxxxxxxxxxx
User ID:    xxxxxxxxxxxxxxx

This does have a drawback of the terminal title no longer reflecting the running process, let me know if there is a way around that!

Hope this helps and happy coding!

@TophC7
Copy link

TophC7 commented Mar 5, 2025

This is so cool and useful! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment