110 lines
3 KiB
Nix
110 lines
3 KiB
Nix
{ lib
|
|
, pkgs
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, gnumake
|
|
, gcc-arm-embedded
|
|
, jdk
|
|
, libfaketime
|
|
, ant
|
|
, makeWrapper
|
|
, dfu-util
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
version = "1.1.0beta";
|
|
pname = "ksoloti";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "ksoloti";
|
|
repo = "ksoloti";
|
|
rev = version;
|
|
sha256 = "sha256-RRwar0X2gI0LyM/pNhnlLet06MzrG4z4lm3kCmzWwBc=";
|
|
};
|
|
|
|
buildInputs = [ jdk libfaketime ];
|
|
|
|
nativeBuildInputs = [
|
|
ant
|
|
gcc-arm-embedded
|
|
gnumake
|
|
makeWrapper
|
|
];
|
|
|
|
propagatedBuildInputs = [
|
|
dfu-util
|
|
gcc-arm-embedded
|
|
];
|
|
|
|
/*
|
|
# Hardcode dfu-util path
|
|
substituteInPlace "platform_linux/upload_fw_dfu.sh" \
|
|
--replace-fail "/bin/dfu-util" ""
|
|
substituteInPlace "platform_linux/upload_fw_dfu.sh" \
|
|
--replace-fail "./dfu-util" "${dfu-util-ksoloti}/bin/dfu-util"
|
|
|
|
*/
|
|
patchPhase = ''
|
|
# Hardcode path to "make"
|
|
for f in "firmware/compile_firmware_linux.sh" \
|
|
"firmware/compile_patch_linux.sh"; do
|
|
substituteInPlace "$f" \
|
|
--replace "make" "${gnumake}/bin/make"
|
|
done
|
|
|
|
# Fix build version
|
|
substituteInPlace "build.xml" \
|
|
--replace-fail "(git missing)" "${version}"
|
|
# Remove build time
|
|
substituteInPlace "build.xml" \
|
|
--replace-fail "<tstamp>" ""
|
|
substituteInPlace "build.xml" \
|
|
--replace-fail \
|
|
'<format property="build.time" pattern="d MMM yyyy, HH:mm:ss"/>' \
|
|
'<property name="build.time" value=""/>'
|
|
substituteInPlace "build.xml" \
|
|
--replace-fail "</tstamp>" ""
|
|
substituteInPlace "build.xml" \
|
|
--replace-fail \
|
|
'{line.separator}</echo>' \
|
|
'{line.separator}</echo> <touch file="src/main/java/axoloti/Version.java" millis="0" />'
|
|
'';
|
|
|
|
buildPhase = ''
|
|
(
|
|
find . -exec touch -d '1970-01-01 00:00' {} \;
|
|
(cd platform_linux; PATH="${pkgs.gcc-arm-embedded}/bin:$PATH" sh compile_firmware.sh BOARD_AXOLOTI_CORE)
|
|
faketime "1970-01-01 00:00:00" ant -Dbuild.runtime=true
|
|
)
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin $out/share/ksoloti
|
|
|
|
cp -r doc firmware chibios platform_linux CMSIS *.txt $out/share/ksoloti/
|
|
install -vD dist/Ksoloti.jar $out/share/ksoloti/
|
|
|
|
patchShebangs $out/share/ksoloti/platform_linux/*.sh
|
|
|
|
rm $out/share/ksoloti/platform_linux/bin/dfu-util
|
|
ln -s ${dfu-util}/bin/dfu-util $out/share/ksoloti/platform_linux/bin/dfu-util
|
|
|
|
makeWrapper ${jdk}/bin/java $out/bin/ksoloti --add-flags "-Dksoloti_release=$out/share/ksoloti -Dksoloti_runtime=$out/share/ksoloti -jar $out/share/ksoloti/Ksoloti.jar" --prefix PATH : ${
|
|
lib.makeBinPath [
|
|
pkgs.gcc-arm-embedded
|
|
]
|
|
}
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "http://ksoloti.github.io";
|
|
description = ''
|
|
Sketching embedded digital audio algorithms.
|
|
|
|
To fix permissions of the Ksoloti USB device node, add a similar udev rule to <literal>services.udev.extraRules</literal>:
|
|
<literal>SUBSYSTEM=="usb", ATTR{idVendor}=="16c0", ATTR{idProduct}=="0442", OWNER="someuser", GROUP="somegroup"</literal>
|
|
'';
|
|
license = licenses.gpl3;
|
|
maintainers = with maintainers; [ ];
|
|
};
|
|
}
|