2025-11-25 17:40:55 -05:00

161 lines
4.4 KiB
Nix

{
config,
lib,
pkgs,
...
}:
{
imports = [ ];
options.me = {
vscode.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install vscode.";
};
vscode.enable_work_profile = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install the remote tunnels vscode extension.";
};
};
config = lib.mkIf (config.me.vscode.enable && config.me.graphical) {
allowedUnfree = [
"vscode"
"vscode-x86_64-unknown-linux-gnu-with-extensions"
"vscode-with-extensions"
"vscode-extension-ms-vscode-remote-remote-ssh"
"vscode-extension-MS-python-vscode-pylance"
];
environment.systemPackages = with pkgs; [
(vscode-with-extensions.override {
vscodeExtensions =
with vscode-extensions;
(
[
bbenoist.nix
ms-azuretools.vscode-docker
ms-vscode-remote.remote-ssh
esbenp.prettier-vscode
]
++ (
if config.me.vscode.enable_work_profile then
[
# ms-python.vscode-pylance
]
else
[
ms-python.python
ms-python.debugpy
]
)
++ (pkgs.vscode-utils.extensionsFromVscodeMarketplace (
if config.me.vscode.enable_work_profile then
[
{
name = "remote-server";
publisher = "ms-vscode";
version = "1.5.3";
sha256 = "MSayIBwvSgIHg6gTrtUotHznvo5kTiveN8iSrehllW0=";
}
{
name = "vscode-python-envs";
publisher = "ms-python";
version = "1.12.0";
sha256 = "8dCnGBuxv+8QwP0FrUZIKFxllVOR2z+wIhyyJgxsRns=";
}
{
name = "vscode-pylance";
publisher = "ms-python";
version = "2025.10.1";
sha256 = "7NLq5huykRAhhEIHjtXLKDBFwQ5yiJKFLG64Tjh0yaM=";
}
{
name = "debugpy";
publisher = "ms-python";
version = "2025.16.0";
sha256 = "QPIDUzzwIfzyicsCwqU2u6hVSjCJMInHhHMBqvL8tYs=";
}
{
name = "python";
publisher = "ms-python";
version = "2025.18.0";
sha256 = "6auzfS1DmOuaqV2rDHSCC9BlrcON4xUrdJZ0N0wYCs4=";
}
]
else
[ ]
))
);
})
];
me.install.user.talexander.file = {
".config/Code/User/settings.json" = {
source = ./files/settings.json;
};
".config/Code/User/keybindings.json" = {
source = ./files/keybindings.json;
};
};
environment.persistence."/persist" = lib.mkIf (config.me.mountPersistence) {
hideMounts = true;
users.talexander = {
directories = [
{
directory = ".config/Code/User/globalStorage";
user = "talexander";
group = "talexander";
mode = "0755";
}
{
directory = ".config/Code/User/workspaceStorage";
user = "talexander";
group = "talexander";
mode = "0755";
}
];
};
};
environment.persistence."/state" = lib.mkIf (config.me.mountPersistence) {
hideMounts = true;
users.talexander = {
directories = [
{
directory = ".config/Code/CachedProfilesData";
user = "talexander";
group = "talexander";
mode = "0755";
}
{
directory = ".config/Code/CachedConfigurations";
user = "talexander";
group = "talexander";
mode = "0755";
}
{
directory = ".config/Code/Cache";
user = "talexander";
group = "talexander";
mode = "0755";
}
{
directory = ".config/Code/CachedData";
user = "talexander";
group = "talexander";
mode = "0755";
}
];
};
};
};
}