summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2025-02-10 21:59:19 +0100
committerMel <einebeere@gmail.com>2025-02-10 21:59:19 +0100
commit04de433a0da70a070d6c7c483e6f99a7fd42b3b7 (patch)
tree6d24c598e295373167fdece555747279a8898179 /modules
parent6ee431a5fa23f240e232eb7dc78f72c8372d5422 (diff)
downloadminerals-04de433a0da70a070d6c7c483e6f99a7fd42b3b7.tar.zst
minerals-04de433a0da70a070d6c7c483e6f99a7fd42b3b7.zip
Add modified ESP-IDF package configuration to VSCodium
Signed-off-by: Mel <einebeere@gmail.com>
Diffstat (limited to 'modules')
-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 = {