Fix VSCode and Signal (and other Electron Apps) Password Store on Sway on NixOS
Apps occasionally need to store secrets on the system. Most applications correctly find the key/secret/password store on the system. Electron apps seem to be the exception…
I’ve not really needed VSCode to store secrets until now.
I’ve had the same issue on Signal but I just patched together a desktop file in /home/USERNAME/.local/share/applications like the following:
Note that I have put signal on the user packages below (replace
USERNAMEwith your username (or if you’re using system packages/run/current-system/sw/bin/signal-desktop))
[Desktop Entry]
Type=Application
Name=Signal Gnome Libsecret
Terminal=false
Exec=/etc/profiles/per-user/USERNAME/bin/signal-desktop --password-store=gnome-libsecret
Icon=/etc/profiles/per-user/USERNAME/share/icons/hicolor/512x512/apps/signal-desktop.png
I could do the same with VSCode, but since I always launch it from the terminal like code ., the desktop file is not invoked leading to it not picking up the --password-store option.
So, digging a little into Nix I came up with the following solution that worked well for me.
Here I assume that you have
gnome-keyringworking already.
My abbreviated /etc/nixos/configuration.nix:
users.users.USERNAME = {
packages = with pkgs; [
(symlinkJoin {
name = "signal-desktop";
paths = [ signal-desktop ];
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
wrapProgram $out/bin/signal-desktop \
--add-flags "--password-store=gnome-libsecret"
'';
})
(symlinkJoin {
# Note: here I use `vscode-fhs`, you can use `vscode` instead
name = "vscode-fhs";
paths = [ vscode-fhs ];
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
wrapProgram $out/bin/code \
--add-flags "--password-store=gnome-libsecret"
'';
})
];
};
Metadata
$ sway --version
sway version 1.11
NixOS 25.11