forked from 30350n/pcb2blender
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
58 lines (52 loc) · 1.9 KB
/
Copy pathflake.nix
File metadata and controls
58 lines (52 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
self.submodules = true;
};
outputs = {nixpkgs, ...}: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
blender = pkgs.blender.overrideAttrs (finalAttrs: prevAttrs: {
pythonPath =
prevAttrs.pythonPath
++ (with pkgs.python311Packages; [
debugpy
flask
pytest
requests
werkzeug
]);
});
in {
devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [
python3
uv
];
shellHook = let
kicadPythonVersion = pkgs.lib.versions.majorMinor pkgs.python3.version;
kicadPythonSitePackages = "lib/python${kicadPythonVersion}/site-packages";
in ''
mkdir -p .vscode/
[[ -f .vscode/settings.json ]] || echo "{}" > .vscode/settings.json
prev_settings=$(mktemp)
cp .vscode/settings.json "$prev_settings"
${pkgs.jq}/bin/jq '
.["blender.executables"] = [
{
"name": "Blender ${blender.version}",
"path": "${blender}/bin/blender",
"isDefault": false
}
]
|
.["basedpyright.analysis.extraPaths"] = [
"${pkgs.kicad-small.src}/${kicadPythonSitePackages}",
"${pkgs.python3Packages.wxpython}/${kicadPythonSitePackages}"
]
' "$prev_settings" > .vscode/settings.json
'';
BLENDER_EXECUTABLE = "${blender}/bin/blender";
};
};
}