An open source DAW for GNU/Linux, inspired by modular synths. http://noisicaa.odahoda.de/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
noisicaa/noisicaa.nix

153 lines
5.5 KiB

# @begin:license
#
# Copyright (c) 2015-2021, Ben Niemann <pink@odahoda.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license
{ withTests ? false
}:
let
nixpkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/d14d83a3691121642be1b0579cf3408a83c558d7.tar.gz") {};
lib = nixpkgs.lib;
stdenv = nixpkgs.stdenv;
fetchFromGitHub = nixpkgs.fetchFromGitHub;
# mach-nix: Create highly reproducible python environments
# https://github.com/DavHau/mach-nix
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
ref = "refs/tags/3.3.0";
}) {
# https://github.com/DavHau/pypi-deps-db as of 2021-10-28
pypiDataRev = "b1b4dcb59dafdf07069afe2c35b80b17bd98e15f";
pypiDataSha256 = "sha256:06vg3ifs8lmz2ch6jvxjc0jlqh213z1kf76y36gbv7qvdzm57rck";
};
python = mach-nix.mkPython {
python = "python38";
# pyside2 is a pain to work with when installed by mach-nix (gets rebuilt from source, needs
# overrides to include work with qtquickcontrols, ...). Let's filter it (and possibly other
# packages) out and install them directly from nixpkgs (see PYTHONPATH below).
requirements = let
req-runtime = lib.strings.splitString "\n" (builtins.readFile ./etc/requirements.txt);
req-dev = lib.strings.splitString "\n" (builtins.readFile ./etc/requirements-dev.txt);
req-all = req-runtime ++ (lib.lists.optionals withTests req-dev);
blacklist = [ "pyside2" ];
is_blacklisted = l: builtins.any (pkg: !isNull (builtins.match (pkg + "=.*") l)) blacklist;
req-filtered = builtins.filter (l: !is_blacklisted l) req-all;
requirements = builtins.concatStringsSep "\n" req-filtered;
in requirements;
_."ruamel.yaml".propagatedBuildInputs.mod = pySelf: oldAttrs: oldVal: oldVal ++ [ pySelf."ruamel_yaml_clib" ];
packagesExtra = [
(mach-nix.buildPythonPackage ./3rdparty/flatpy)
];
};
# gitignoreSource: Nix functions for filtering local git sources
# https://github.com/hercules-ci/gitignore.nix
gitignoreSrc = fetchFromGitHub {
owner = "hercules-ci";
repo = "gitignore.nix";
rev = "9e80c4d83026fa6548bc53b1a6fab8549a6991f6"; # 2021-10-16
sha256 = "sha256:04n9chlpbifgc5pa3zx6ff3rji9am6msrbn1z3x1iinjz2xjfp4p";
};
inherit (import gitignoreSrc { inherit lib; }) gitignoreSource;
# FlatBuffers: Memory Efficient Serialization Library
# https://github.com/google/flatbuffers
flatbuffers = stdenv.mkDerivation rec {
pname = "flatbuffers";
version = "2.0.0-git";
src = fetchFromGitHub {
owner = "google";
repo = "flatbuffers";
# The latest version which populates 'declaration_file'.
rev = "c871df7702c46df7bfb1783aebbf49d054f9282e";
sha256 = "sha256:1a7cj068vap1m3sq9wvzyjjj0vgnk7bxm18mfwvvadl68yh9ij1f";
};
nativeBuildInputs = [ nixpkgs.cmake ];
cmakeFlags = [ "-DFLATBUFFERS_BUILD_TESTS=OFF" ];
doCheck = false;
};
qt5 = nixpkgs.libsForQt515;
in stdenv.mkDerivation {
pname = "noisicaa";
version = lib.strings.fileContents ./VERSION;
src = gitignoreSource ./.;
nativeBuildInputs = [
nixpkgs.makeWrapper
python
nixpkgs.wafHook
nixpkgs.pkg-config
flatbuffers
nixpkgs.librsvg
nixpkgs.libjack2
nixpkgs.ffmpeg.dev
nixpkgs.fmt
qt5.qmake
qt5.qtbase
qt5.qtquickcontrols2.dev
qt5.qttools.dev
nixpkgs.faust
] ++ lib.lists.optional withTests [
nixpkgs.gtest.dev
nixpkgs.lcov
nixpkgs.qtcreator
nixpkgs.jack2
];
dontWrapQtApps = true;
wafConfigureFlags = "--release " + (if withTests then "--with-tests" else "--without-tests");
postInstall = ''
patchShebangs $out/bin/noisicaa
substituteInPlace $out/bin/noisicaa --replace python3 ${python}/bin/python
wrapProgram $out/bin/noisicaa \
--prefix LD_LIBRARY_PATH : $out/lib/noisicaa/ \
--set PYTHONPATH $out/lib/noisicaa/:$PYTHONPATH \
--set QT_QPA_PLATFORM_PLUGIN_PATH $QT_QPA_PLATFORM_PLUGIN_PATH \
--set QT_PLUGIN_PATH $QT_PLUGIN_PATH \
--set QML2_IMPORT_PATH $QML2_IMPORT_PATH \
--set QT5_LIBDIR $QT5_LIBDIR
'';
PYTHONPATH=builtins.concatStringsSep ":" [
"${nixpkgs.python38.pkgs.pyside2}/lib/python3.8/site-packages"
"${nixpkgs.python38.pkgs.shiboken2}/lib/python3.8/site-packages"
];
# https://discourse.nixos.org/t/how-can-i-build-a-python-package-that-uses-qt/7657
QT_QPA_PLATFORM_PLUGIN_PATH = "${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins";
QT_PLUGIN_PATH = "${qt5.qtsvg.bin}/lib/qt-${qt5.qtsvg.version}/plugins";
QML2_IMPORT_PATH = builtins.concatStringsSep ":" [
"${qt5.qtdeclarative.bin}/lib/qt-${qt5.qtdeclarative.version}/qml"
"${qt5.qtquickcontrols}/lib/qt-${qt5.qtquickcontrols.version}/qml"
"${qt5.qtquickcontrols2.bin}/lib/qt-${qt5.qtquickcontrols2.version}/qml"
"${qt5.qtgraphicaleffects}/lib/qt-${qt5.qtgraphicaleffects.version}/qml"
];
QT5_LIBDIR = "${qt5.qtbase.out}/lib/";
}