forked from bastl-instruments/kastle2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
78 lines (69 loc) · 2.08 KB
/
flake.nix
File metadata and controls
78 lines (69 loc) · 2.08 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
{
description = "Kastle 2 development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{ self, nixpkgs, ... }:
let
# Helper to generate a dev shell output for all supported architecture:systems pairings
forAllSystems =
function:
nixpkgs.lib.genAttrs [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
] (system: function nixpkgs.legacyPackages.${system});
in
{
devShells = forAllSystems (
pkgs:
let
pico-sdk = pkgs.pico-sdk.override { withSubmodules = true; };
in
{
default = pkgs.mkShell {
name = "kastle-2-dev-shell";
buildInputs = [
pkgs.cmake
pkgs.doxygen
pkgs.gcc-arm-embedded
pkgs.gnumake
pkgs.openocd
pkgs.picotool
pkgs.pkg-config
pkgs.python3
];
PICO_SDK_PATH = "${pico-sdk}/lib/pico-sdk";
PICO_TOOLCHAIN_PATH = "${pkgs.gcc-arm-embedded}/bin";
shellHook =
let
gum = "${pkgs.gum}/bin/gum";
in
''
if [ ! -f "./code/build/Makefile" ]; then
echo "No ./code/build/Makefile file, invoking ./configure.sh"
./configure.sh
fi
TITLE=$(${pkgs.gum}/bin/gum style \
--bold \
--foreground '#00fc94' \
"🏰 Bastl Kastle 2 Development Shell 🏰")
SUBTITLE=$(${pkgs.gum}/bin/gum style \
--align center \
--width 40 \
"Ready for development")
${pkgs.gum}/bin/gum style \
--align center \
--border thick \
--padding "1 1" \
--border-foreground '#cdb8a5' \
"$TITLE
$SUBTITLE"
'';
};
}
);
};
}