2024-09-11 11:05:25 +00:00
|
|
|
{
|
|
|
|
description = "A very basic flake";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
|
|
|
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, ... }@inputs:
|
|
|
|
let
|
|
|
|
forAllSystems = function:
|
|
|
|
inputs.nixpkgs.lib.genAttrs [
|
|
|
|
"x86_64-linux"
|
|
|
|
"aarch64-linux"
|
|
|
|
]
|
|
|
|
(system: function (import inputs.nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
config.allowUnfree = true;
|
|
|
|
}));
|
|
|
|
in
|
|
|
|
{
|
|
|
|
packages = forAllSystems (pkgs:
|
|
|
|
let
|
|
|
|
infinitime-nrf5-sdk = pkgs.nrf5-sdk.overrideAttrs (old: {
|
|
|
|
version = "15.3.0";
|
|
|
|
src = pkgs.fetchzip {
|
|
|
|
url = "https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/sdks/nrf5/binaries/nrf5sdk153059ac345.zip";
|
|
|
|
sha256 = "sha256-pfmhbpgVv5x2ju489XcivguwpnofHbgVA7bFUJRTj08=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
in
|
|
|
|
with pkgs; {
|
|
|
|
default = stdenv.mkDerivation rec {
|
|
|
|
name = "infinitime";
|
|
|
|
|
2024-09-15 15:57:10 +00:00
|
|
|
src = fetchFromGitea {
|
|
|
|
domain = "git.techwork.zone";
|
|
|
|
owner = "scott";
|
2024-09-11 11:05:25 +00:00
|
|
|
repo = "InfiniTime";
|
2024-09-15 16:00:38 +00:00
|
|
|
rev = "1.15.1";
|
|
|
|
hash = "sha256-9cy7qYRZrg7qZZwQzYeMIZivGLZ5uGUoTyPgHEvdnZ8=";
|
2024-09-11 11:05:25 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
nodePackages.lv_font_conv
|
|
|
|
python3
|
|
|
|
python3.pkgs.cbor
|
|
|
|
python3.pkgs.click
|
|
|
|
python3.pkgs.cryptography
|
|
|
|
python3.pkgs.intelhex
|
|
|
|
python3.pkgs.pillow
|
|
|
|
adafruit-nrfutil
|
|
|
|
patch
|
|
|
|
git
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# /usr/bin/env is not available in the build sandbox
|
|
|
|
substituteInPlace src/displayapp/fonts/generate.py --replace "'/usr/bin/env', 'patch'" "'patch'"
|
|
|
|
substituteInPlace tools/mcuboot/imgtool.py --replace "/usr/bin/env python3" "${python3}/bin/python3"
|
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
''-DARM_NONE_EABI_TOOLCHAIN_PATH=${gcc-arm-embedded-10}''
|
|
|
|
''-DNRF5_SDK_PATH=${infinitime-nrf5-sdk}/share/nRF5_SDK''
|
|
|
|
''-DBUILD_DFU=1''
|
|
|
|
''-DBUILD_RESOURCES=1''
|
|
|
|
''-DCMAKE_SOURCE_DIR=${src}''
|
|
|
|
];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
SOURCES_DIR=${src} BUILD_DIR=. OUTPUT_DIR=$out ./post_build.sh
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
devShells = forAllSystems (pkgs:
|
|
|
|
let
|
|
|
|
infinitime-nrf5-sdk = pkgs.nrf5-sdk.overrideAttrs (old: {
|
|
|
|
version = "15.3.0";
|
|
|
|
src = pkgs.fetchzip {
|
|
|
|
url = "https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/sdks/nrf5/binaries/nrf5sdk153059ac345.zip";
|
|
|
|
sha256 = "sha256-pfmhbpgVv5x2ju489XcivguwpnofHbgVA7bFUJRTj08=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
in
|
|
|
|
{
|
|
|
|
default =
|
|
|
|
pkgs.buildFHSUserEnv {
|
|
|
|
name = "infinitime-devenv";
|
|
|
|
# build tools
|
|
|
|
targetPkgs = pkgs: (with pkgs; [
|
|
|
|
cmake
|
|
|
|
nodePackages.lv_font_conv
|
|
|
|
python3
|
|
|
|
python3.pkgs.cbor
|
|
|
|
python3.pkgs.click
|
|
|
|
python3.pkgs.cryptography
|
|
|
|
python3.pkgs.intelhex
|
|
|
|
adafruit-nrfutil
|
|
|
|
|
|
|
|
(pkgs.writeShellScriptBin "cmake_infinitime" ''
|
|
|
|
cmake -DARM_NONE_EABI_TOOLCHAIN_PATH="${pkgs.gcc-arm-embedded-10}" \
|
|
|
|
-DNRF5_SDK_PATH="${infinitime-nrf5-sdk}/share/nRF5_SDK" \
|
|
|
|
"$@"
|
|
|
|
'')
|
|
|
|
]);
|
|
|
|
};
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|