summaryrefslogtreecommitdiff
path: root/core.nix
diff options
context:
space:
mode:
Diffstat (limited to 'core.nix')
-rw-r--r--core.nix27
1 files changed, 7 insertions, 20 deletions
diff --git a/core.nix b/core.nix
index 8d2575e..a67e83d 100644
--- a/core.nix
+++ b/core.nix
@@ -1,21 +1,6 @@
-{ pkgs, ... }:
+{ pkgs, libs ? [ ], ... }:
-let
- spi = pkgs.fetchFromGitHub {
- owner = "PaulStoffregen";
- repo = "SPI";
- rev = "574ab8c7a8a45ea21cc56dcc6b7361da90868e86";
- sha256 = "I3M7w9SNEXvPD0ynuZ38bnTaenGEORg72E5YC2x6ek4=";
- };
-
- wire = pkgs.fetchFromGitHub {
- owner = "PaulStoffregen";
- repo = "Wire";
- rev = "15018075857fa0176d8a5fc610fc564427282ca0";
- sha256 = "GTfqmQykFS4nXXPBhQHe2gpEUY2sH0ESHh28ZrIW/dE=";
- };
-
-in pkgs.stdenvNoCC.mkDerivation rec {
+pkgs.stdenvNoCC.mkDerivation rec {
name = "teensy-core";
version = "1.54";
@@ -31,7 +16,10 @@ in pkgs.stdenvNoCC.mkDerivation rec {
gcc-arm-embedded
];
- buildPhase = ''
+ buildPhase = let
+ copyLibs = libs: builtins.concatStringsSep "\n" (map (lib: "cp ${lib}/*.{cpp,h} .") libs);
+
+ in ''
export CC=arm-none-eabi-gcc
export CXX=arm-none-eabi-g++
@@ -43,8 +31,7 @@ in pkgs.stdenvNoCC.mkDerivation rec {
--subst-var-by TEENSY_LIB .
cp ${./flags.mk} flags.mk
- cp ${spi}/*.{cpp,h} .
- cp ${wire}/*.{cpp,h} .
+ ${copyLibs libs}
make
ar rvs libteensy-core.a *.o