-
Notifications
You must be signed in to change notification settings - Fork 133
Expand file tree
/
Copy pathflake.nix
More file actions
97 lines (93 loc) · 3.33 KB
/
flake.nix
File metadata and controls
97 lines (93 loc) · 3.33 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
description = "Development environment for PebbleOS";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
};
outputs =
{ self, nixpkgs }:
let
forSupportedSystems = nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
in
{
devShells = forSupportedSystems (
system:
let
pkgs = import nixpkgs { inherit system; };
gcc-arm-embedded-14_2r1 = pkgs.gcc-arm-embedded.overrideAttrs (old: rec {
version = "14.2.rel1";
src = pkgs.fetchurl {
url = "https://developer.arm.com/-/media/Files/downloads/gnu/${version}/binrel/arm-gnu-toolchain-${version}-${old.platform}-arm-none-eabi.tar.xz";
# hashes obtained from location ${url}.sha256asc
sha256 =
{
aarch64-darwin = "c7c78ffab9bebfce91d99d3c24da6bf4b81c01e16cf551eb2ff9f25b9e0a3818";
aarch64-linux = "87330bab085dd8749d4ed0ad633674b9dc48b237b61069e3b481abd364d0a684";
x86_64-linux = "62a63b981fe391a9cbad7ef51b17e49aeaa3e7b0d029b36ca1e9c3b2a9b78823";
}
.${pkgs.stdenv.hostPlatform.system}
or (throw "Unsupported system: ${pkgs.stdenv.hostPlatform.system}");
};
});
in
{
default = pkgs.mkShellNoCC {
hardeningDisable = [ "fortify" ]; # waf expects unoptimized builds
nativeBuildInputs = with pkgs; [
pkg-config
];
buildInputs = with pkgs; [
emscripten
gcc-arm-embedded-14_2r1
gettext
git
librsvg
nodejs
openocd
protobuf
python313
] ++ lib.optionals stdenv.isLinux [
clang_multi
gcc
# Required for Moddable build
dash
glib
gtk3
];
shellHook = ''
# Ensure that apple command line tools are installed on macOS
${pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
# Verify Apple Command Line Tools are installed
if ! /usr/bin/xcrun --find clang &> /dev/null; then
echo "❌ Error: Apple Command Line Tools not found!"
echo " Please install with: xcode-select --install"
exit 1
fi
echo "✓ Apple CLT found: $(/usr/bin/clang --version | head -1)"
''}
# Disable pyenv to avoid conflicts
export PYENV_VERSION=system
unset PYENV_ROOT
# Prepare the python venv
export VENV_DIR=".venv"
if [ ! -d "$VENV_DIR" ]; then
echo "Creating virtual environment..."
python -m venv "$VENV_DIR"
source "$VENV_DIR/bin/activate"
if [ -f "requirements.txt" ]; then
echo "Installing Python dependencies..."
pip install -r requirements.txt
fi
else
source "$VENV_DIR/bin/activate"
fi
echo "Python virtual environment activated."
'';
};
}
);
};
}