From 3de4d0155e37df8bcbb5f7f0ddb6dce04dea527e Mon Sep 17 00:00:00 2001 From: shimun Date: Fri, 30 Oct 2020 15:43:25 +0100 Subject: [PATCH] build --- default.nix | 42 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/default.nix b/default.nix index 271a979..c6d172a 100644 --- a/default.nix +++ b/default.nix @@ -5,44 +5,20 @@ let ] ++ (with builtins; map (d: getAttr d python-packages) (filter (d: stringLength d > 0) (pkgs.lib.splitString "\n" (builtins.readFile ./tools/requirements.txt)))))); python-with-my-packages = pkgs.python3.withPackages pyPackages; src = ./.; - tinycbor = with pkgs; stdenv.mkDerivation { - name = "tinycbor"; - src = "${src}/tinycbor"; - makeFlags = [ "PREFIX=$(out)" "prefix=$(out)" ]; - buildInputs = [ gcc gcc-arm-embedded-8 ]; - }; - standalone = with pkgs; stdenv.mkDerivation { - name = "solo-standalone"; - src = [ - src - tinycbor - ]; - buildInputs = [ gnumake gcc gcc-arm-embedded-8 python-with-my-packages ]; - installPhase = '' - make clean - make all PREFIX=$(out)" "prefix=$(out) - mkdir -p $out/bin - cp main $out/bin/ - ''; - }; in with pkgs; stdenv.mkDerivation { name = "solo"; - outputs = [ "out" "firmware" ]; - src = builtins.filterSource (path: type: (!(lib.hasSuffix path "./tinycbor/lib") && !(lib.hasSuffix path ".hex")&& !(lib.hasSuffix path ".sha256")&& !(lib.hasSuffix path ".elf"))) ./.; + outputs = [ "out" ]; + src = with lib; builtins.filterSource (path: type: !(hasSuffix path "hex" || hasSuffix path "sha256")) src; buildInputs = [ gnumake gcc gcc-arm-embedded-8 git python-with-my-packages ]; -########installPhase = '' -######## mkdir -p $firmware $standalone/bin/ -######## cp main $standalone/bin/ -######## cd stm32l432 -######## make firmware -######## cp *.hex *.sha256 *.elf cubeconfig_stm32l442.ioc $firmware/ -########''; + phases = [ "unpackPhase" "configurePhase" "buildPhase" "installPhase" ]; installPhase = '' - cd targets/stm32l432 - make cbor + mkdir -p $out/firmware $out + cd targets/stm32l432 + make cbor make build-hacker - cp *.hex *.sha256 *.elf cubeconfig_stm32l442.ioc $firmware/ - ''; + cp *.hex *.sha256 *.elf cubeconfig_stm32l442.ioc $out/firmware/ + ''; + keepDebugInfo = true; }