Skip to content

Instantly share code, notes, and snippets.

@pveierland
Last active August 9, 2022 18:13
Show Gist options
  • Save pveierland/b8a6068c6a12f972ccc7980d9dbd63c3 to your computer and use it in GitHub Desktop.
Save pveierland/b8a6068c6a12f972ccc7980d9dbd63c3 to your computer and use it in GitHub Desktop.
VSCode Nix Home Manager Settings Hack
{ config, lib, ... }:
let
codeSettingsPath = "${config.home.homeDirectory}/.config/Code/User/settings.json";
in
{
home.activation.codeSettingsHackRemove = lib.hm.dag.entryBefore [ "checkLinkTargets" ] ''
if [ -e "${codeSettingsPath}" ]; then
rm -f "${codeSettingsPath}"
fi
'';
home.activation.codeSettingsHackApply = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
if [ -L "${codeSettingsPath}" ] && [ -e "${codeSettingsPath}" ]; then
cp --remove-destination "$(readlink ${codeSettingsPath})" "${codeSettingsPath}"
chmod u+w "${codeSettingsPath}"
fi
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment