summaryrefslogtreecommitdiff
path: root/modules/home
diff options
context:
space:
mode:
Diffstat (limited to 'modules/home')
-rw-r--r--modules/home/code.nix40
1 files changed, 38 insertions, 2 deletions
diff --git a/modules/home/code.nix b/modules/home/code.nix
index e736c11..5513f12 100644
--- a/modules/home/code.nix
+++ b/modules/home/code.nix
@@ -7,8 +7,18 @@
}:
let
- settings = import ./../../configs/vscode/settings.nix { inherit pkgs lib; };
- keybindings = import ./../../configs/vscode/keybindings.nix { };
+ inherit (lib)
+ elem
+ head
+ range
+ versions
+ removePrefix
+ stringAsChars
+ ;
+
+ # filters characters from string `s` according to funciton `f`.
+ # NOTE: this could probably be a util.
+ filterString = f: s: stringAsChars (c: if f c then c else "") s;
extensions = with unstablePkgs.vscode-extensions; [
# Microsoft vendor extensions
@@ -58,6 +68,32 @@ let
ms-vscode.remote-repositories
github.remotehub
];
+
+ inherit (pkgs) esp-idf-full;
+ esp-idf-python-env = head esp-idf-full.propagatedBuildInputs;
+
+ digits = map toString (range 0 9);
+ filterVersionString = v: filterString (c: elem c digits || c == ".") v;
+ mkVersion = v: versions.majorMinor (filterVersionString v);
+
+ # the ESP-IDF extension for VSCode for some reason
+ # really wants a python environment under this path in `tools/`...
+ espIdfV = mkVersion esp-idf-full.version;
+ pyEnvV = mkVersion (removePrefix "python3" esp-idf-python-env.name);
+ pythonEnvFolderName = "idf${espIdfV}_py${pyEnvV}_env";
+
+ esp-idf = esp-idf-full.overrideAttrs (attrs: {
+ installPhase =
+ (attrs.installPhase or "")
+ + ''
+ mkdir -p $out/tools/python_env
+ ln -s ${esp-idf-python-env} $out/tools/python_env/${pythonEnvFolderName}
+ '';
+ });
+
+ settings = import ./../../configs/vscode/settings.nix { inherit pkgs lib esp-idf; };
+ keybindings = import ./../../configs/vscode/keybindings.nix { };
+
in
{
programs.vscode = {