diff --git a/flake.nix b/flake.nix index 7fd1eef..5703e35 100644 --- a/flake.nix +++ b/flake.nix @@ -59,6 +59,8 @@ in { + packages = forAllSystems (system: import ./packages nixpkgs.legacyPackages.${system}); + formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra); overlays = import ./overlays {inherit inputs;}; @@ -67,7 +69,6 @@ eddie = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs outputs; - pkgs-unstable = import nixpkgs-unstable { system = "x86_64-linux"; config.allowUnfree = true; }; }; modules = [ nix-flatpak.nixosModules.nix-flatpak diff --git a/home/home.nix b/home/home.nix index 262028c..2f23485 100644 --- a/home/home.nix +++ b/home/home.nix @@ -5,7 +5,7 @@ # You can add overlays here overlays = [ # Add overlays your own flake exports (from overlays and pkgs dir): - # outputs.overlays.additions + outputs.overlays.additions outputs.overlays.modifications outputs.overlays.unstable-packages @@ -297,7 +297,8 @@ # audacity tenacity supercollider-with-plugins - bitwig-studio + # pkgs.unstable.bitwig-studio + bitwig-studio-beta blender davinci-resolve-studio steam @@ -327,7 +328,8 @@ ardour parinfer-rust-emacs dockfmt - (callPackage ../packages/mioctl/mioctl.nix {}) + + mioctl # Audio plugins (LV2, VST2, VST3, LADSPA) eq10q @@ -351,19 +353,17 @@ helio-workstation stochas - (callPackage ../packages/tal/bassline.nix {}) - (callPackage ../packages/tal/j8.nix {}) - (callPackage ../packages/tal/u-no-lx.nix {}) - (callPackage ../packages/amplocker/package.nix {}) - (callPackage ../packages/chair-audio/snare.nix {}) - (callPackage ../packages/chair-audio/cymb.nix {}) - (callPackage ../packages/the-usual-suspects/vavra/vavra.nix {}) - (callPackage ../packages/the-usual-suspects/nodal-red/nodal-red.nix {}) - (callPackage ../packages/the-usual-suspects/xenia/xenia.nix {}) - (callPackage ../packages/the-usual-suspects/ostirus/ostirus.nix {}) - (callPackage ../packages/the-usual-suspects/osirus/osirus.nix {}) - - # (callPackage ../packages/cecelia5/default.nix {}) + tal-bassline + tal-j8 + tal-u-no-lx + amplocker + chair-snare + chair-cymb + tus-vavra + tus-nodal-red + tus-xenia + tus-ostirus + tus-osirus # Fonts fira-code diff --git a/overlays/default.nix b/overlays/default.nix index 93d444b..fb8a682 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,16 +1,12 @@ # This file defines overlays {inputs, ...}: { # This one brings our custom packages from the 'pkgs' directory - # additions = final: _prev: import ../pkgs final.pkgs; + additions = final: _prev: import ../packages final.pkgs; # This one contains whatever you want to overlay # You can change versions, add patches, set compilation flags, anything really. # https://nixos.wiki/wiki/Overlays modifications = final: prev: { - # example = prev.example.overrideAttrs (oldAttrs: rec { - # ... - # }); - ulauncher = prev.ulauncher.overrideAttrs (old: { propagatedBuildInputs = with prev.python3Packages; old.propagatedBuildInputs diff --git a/packages/bitwig-beta/bitwig-studio-beta.nix b/packages/bitwig-beta/bitwig-studio-beta.nix new file mode 100644 index 0000000..ef9ec2c --- /dev/null +++ b/packages/bitwig-beta/bitwig-studio-beta.nix @@ -0,0 +1,144 @@ +{ + stdenv, + fetchurl, + alsa-lib, + atk, + cairo, + dpkg, + ffmpeg, + freetype, + gdk-pixbuf, + glib, + gtk3, + harfbuzz, + lib, + libglvnd, + libjack2, + libjpeg, + libnghttp2, + libxkbcommon, + makeWrapper, + pango, + pipewire, + pulseaudio, + vulkan-loader, + wrapGAppsHook3, + xcb-imdkit, + xdg-utils, + xorg, + zlib, +}: + +stdenv.mkDerivation rec { + pname = "bitwig-studio-unwrapped"; + version = "5.3-beta-3"; + + src = fetchurl { + name = "bitwig-studio-${version}.deb"; + url = "https://downloads-secure.bitwig.com/5.3%20Beta%203/bitwig-studio-5.3-beta-3.deb?__token__=st=1734721071.0~exp=1734721671.0~hmac=b69ea20705e6b169a0dbc6a7944dcbc428f58d83dedb93b2cc81f5c0d173862a&source_url=/dl/Bitwig%20Studio/5.3%20Beta%203/installer_linux/"; + sha256 = "sha256-3T1Jg+WgETi8nbmiqYNw/FylvF8LkIbAw+iEOjpbKqU="; + + }; + + nativeBuildInputs = [ + dpkg + makeWrapper + wrapGAppsHook3 + ]; + + dontBuild = true; + dontWrapGApps = true; # we only want $gappsWrapperArgs here + + buildInputs = with xorg; [ + alsa-lib + atk + cairo + freetype + gdk-pixbuf + glib + gtk3 + harfbuzz + libglvnd + libjack2 + # libjpeg8 is required for converting jpeg's to colour palettes + libjpeg + libnghttp2 + libxcb + libXcursor + libX11 + libXtst + libxkbcommon + pango + pipewire + pulseaudio + (lib.getLib stdenv.cc.cc) + vulkan-loader + xcb-imdkit + xcbutil + xcbutilwm + zlib + ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + cp -r opt/bitwig-studio $out/libexec + ln -s $out/libexec/bitwig-studio $out/bin/bitwig-studio + cp -r usr/share $out/share + + # Bitwig includes a copy of libxcb-imdkit. + # Removing it will force it to use our version. + rm $out/libexec/lib/bitwig-studio/libxcb-imdkit.so.1 + + substitute usr/share/applications/com.bitwig.BitwigStudio.desktop \ + $out/share/applications/com.bitwig.BitwigStudio.desktop \ + --replace /usr/bin/bitwig-studio $out/bin/bitwig-studio + + runHook postInstall + ''; + + postFixup = '' + # patchelf fails to set rpath on BitwigStudioEngine, so we use + # the LD_LIBRARY_PATH way + + find $out -type f -executable \ + -not -name '*.so.*' \ + -not -name '*.so' \ + -not -name '*.jar' \ + -not -name 'jspawnhelper' \ + -not -path '*/resources/*' | \ + while IFS= read -r f ; do + patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" $f + # make xdg-open overrideable at runtime + wrapProgram $f \ + "''${gappsWrapperArgs[@]}" \ + --prefix PATH : "${lib.makeBinPath [ ffmpeg ]}" \ + --suffix PATH : "${lib.makeBinPath [ xdg-utils ]}" \ + --suffix LD_LIBRARY_PATH : "${lib.strings.makeLibraryPath buildInputs}" + done + + find $out -type f -executable -name 'jspawnhelper' | \ + while IFS= read -r f ; do + patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" $f + done + ''; + + meta = with lib; { + description = "Digital audio workstation"; + longDescription = '' + Bitwig Studio is a multi-platform music-creation system for + production, performance and DJing, with a focus on flexible + editing tools and a super-fast workflow. + ''; + homepage = "https://www.bitwig.com/"; + license = licenses.unfree; + platforms = [ "x86_64-linux" ]; + maintainers = with maintainers; [ + bfortz + michalrus + mrVanDalo + ]; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + }; +} diff --git a/packages/bitwig-beta/bitwig-wrapper.nix b/packages/bitwig-beta/bitwig-wrapper.nix new file mode 100644 index 0000000..0bda040 --- /dev/null +++ b/packages/bitwig-beta/bitwig-wrapper.nix @@ -0,0 +1,49 @@ +{ + stdenv, + bubblewrap, + mktemp, + writeShellScript, + bitwig-studio-unwrapped, +}: +stdenv.mkDerivation { + inherit (bitwig-studio-unwrapped) version; + + pname = "bitwig-studio"; + + dontUnpack = true; + dontConfigure = true; + dontBuild = true; + dontPatchELF = true; + dontStrip = true; + + installPhase = + let + wrapper = writeShellScript "bitwig-studio" '' + set -e + + echo "Creating temporary directory" + TMPDIR=$(${mktemp}/bin/mktemp --directory) + echo "Temporary directory: $TMPDIR" + echo "Copying default Vamp Plugin settings" + cp -r ${bitwig-studio-unwrapped}/libexec/resources/VampTransforms $TMPDIR + echo "Changing permissions to be writable" + chmod -R u+w $TMPDIR/VampTransforms + + echo "Starting Bitwig Studio in Bubblewrap Environment" + ${bubblewrap}/bin/bwrap \ + --bind / / \ + --bind $TMPDIR/VampTransforms ${bitwig-studio-unwrapped}/libexec/resources/VampTransforms \ + --dev-bind /dev /dev \ + ${bitwig-studio-unwrapped}/bin/bitwig-studio \ + || true + + echo "Bitwig exited, removing temporary directory" + rm -rf $TMPDIR + ''; + in + '' + mkdir -p $out/bin + cp ${wrapper} $out/bin/bitwig-studio + cp -r ${bitwig-studio-unwrapped}/share $out + ''; +} diff --git a/packages/cecelia5/default.nix b/packages/cecelia5/default.nix deleted file mode 100644 index b073557..0000000 --- a/packages/cecelia5/default.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - lib, - python311, - fetchFromGitHub, - pkgs -}: - -let - python311 = pkgs.python311.override { - self = python311; - packageOverrides = pyfinal: pyprev: { - pyo = pyfinal.callPackage ./pyo.nix { }; - }; - }; - -in -python311.pkgs.buildPythonApplication rec { - pname = "cecilia5"; - version = "5.4.0"; - pyproject = true; - - src = fetchFromGitHub { - owner = "belangeo"; - repo = "cecilia5"; - rev = version; - hash = "sha256-8WnzVSaDz4x6JgRGSI4Ra60hDS1fy+oCRLdyQIfq6WI="; - }; - - build-system = [ - python311.pkgs.setuptools - python311.pkgs.wheel - python311.pkgs.pyo - python311.pkgs.wxpython - python311.pkgs.numpy - ]; - - pythonImportsCheck = [ - "cecilia5" - ]; - - meta = { - description = "Ear-bending noises and music"; - homepage = "https://github.com/belangeo/cecilia5"; - mainProgram = "cecilia5"; - }; -} diff --git a/packages/cecelia5/pyo.nix b/packages/cecelia5/pyo.nix deleted file mode 100644 index 727aeae..0000000 --- a/packages/cecelia5/pyo.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - lib, - buildPythonPackage, - fetchPypi, - setuptools, - wheel, - pkgs -}: - -buildPythonPackage rec { - pname = "pyo"; - version = "1.0.5"; - - src = fetchPypi { - inherit pname version; - hash = "sha256-4ELZR6C2QbQA4ij54h7soh34v0iVxtvQE/h2ONdyjjE="; - }; - - propagatedBuildInputs = with pkgs; [ - portaudio - libsndfile - portmidi - liblo - ]; - - # do not run tests - doCheck = false; - - # specific to buildPythonPackage, see its reference - pyproject = true; - build-system = [ - setuptools - wheel - ]; -} diff --git a/packages/default.nix b/packages/default.nix new file mode 100644 index 0000000..08e9c65 --- /dev/null +++ b/packages/default.nix @@ -0,0 +1,19 @@ +# Custom packages, that can be defined similarly to ones from nixpkgs +# You can build them using 'nix build .#example' +pkgs: { + tal-bassline = pkgs.callPackage ./tal/bassline.nix {}; + tal-j8 = pkgs.callPackage ./tal/j8.nix {}; + tal-u-no-lx = pkgs.callPackage ./tal/u-no-lx.nix {}; + amplocker = pkgs.callPackage ./amplocker/package.nix {}; + chair-snare = pkgs.callPackage ./chair-audio/snare.nix {}; + chair-cymb = pkgs.callPackage ./chair-audio/cymb.nix {}; + tus-vavra = pkgs.callPackage ./the-usual-suspects/vavra/vavra.nix {}; + tus-nodal-red = pkgs.callPackage ./the-usual-suspects/nodal-red/nodal-red.nix {}; + tus-xenia = pkgs.callPackage ./the-usual-suspects/xenia/xenia.nix {}; + tus-ostirus = pkgs.callPackage ./the-usual-suspects/ostirus/ostirus.nix {}; + tus-osirus = pkgs.callPackage ./the-usual-suspects/osirus/osirus.nix {}; + paulxstretch = pkgs.callPackage ./paulxstretch/paulxstretch.nix {}; + mioctl = pkgs.callPackage ./mioctl/mioctl.nix {}; + + bitwig-studio-beta = pkgs.callPackage ./bitwig-beta/bitwig-studio-beta.nix {}; +} diff --git a/packages/paulxstretch/paulxstretch.nix b/packages/paulxstretch/paulxstretch.nix new file mode 100644 index 0000000..5e18373 --- /dev/null +++ b/packages/paulxstretch/paulxstretch.nix @@ -0,0 +1,107 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, pkg-config +, alsa-lib +, freetype +, webkitgtk +, curl +, fftwFloat +, jack2 +, xorg +, pcre2 +, pcre +, libuuid +, libselinux +, libsepol +, libthai +, libdatrie +, libxkbcommon +, libepoxy +, libsysprof-capture +, sqlite +, libpsl +}: +let + buildType = "Release"; +in +stdenv.mkDerivation (finalAttrs: { + pname = "paulxstretch"; + version = "1.6.0"; + + src = fetchFromGitHub { + owner = "essej"; + repo = finalAttrs.pname; + rev = "v${finalAttrs.version}"; + sha256 = "sha256-Oen9W7frt7l1m9YVJCFSIDKXdmj8tWrYx68+V2Mozt0="; + fetchSubmodules = true; + }; + + nativeBuildInputs = [ cmake pkg-config ]; + buildInputs = [ + freetype + alsa-lib + webkitgtk + curl + fftwFloat + jack2 + xorg.libX11 + xorg.libXext + xorg.libXinerama + xorg.xrandr + xorg.libXcursor + xorg.libXfixes + xorg.libXrender + xorg.libXScrnSaver + ]; + + # JUCE dlopens these, make sure they are in rpath + # Otherwise, segfault will happen + NIX_LDFLAGS = (toString [ + "-lX11" + "-lXext" + "-lXcursor" + "-lXinerama" + "-lXrandr" + "-lXfixes" + "-lXrender" + "-lXss" + ]); + + # Needed for LTO to work, currently unsure as to why + cmakeFlags = [ + "-DCMAKE_AR=${stdenv.cc.cc}/bin/gcc-ar" + "-DCMAKE_RANLIB=${stdenv.cc.cc}/bin/gcc-ranlib" + "-DCMAKE_NM=${stdenv.cc.cc}/bin/gcc-nm" + ]; + + cmakeBuildType = buildType; + + installPhase = let + vst3path = "${placeholder "out"}/lib/vst3"; + binpath = "${placeholder "out"}/bin"; + clappath = "${placeholder "out"}/lib/clap"; + in + '' + runHook preInstall + + mkdir -p ${vst3path} + mkdir -p ${binpath} + mkdir -p ${clappath} + + cp -R PaulXStretch_artefacts/${buildType}/VST3/* ${vst3path} + cp -R PaulXStretch_artefacts/${buildType}/Standalone/* ${binpath} + cp -R PaulXStretch_artefacts/${buildType}/CLAP/* ${clappath} + + runHook postInstall + ''; + + meta = with lib; { + description = "Extreme timestretch plugin"; + homepage = "https://sonosaurus.com/paulxstretch/"; + license = licenses.gpl3; + platforms = platforms.linux; + maintainers = with maintainers; [ polygon ]; + }; +}) diff --git a/packages/u-he/twangstrom.nix b/packages/u-he/twangstrom.nix deleted file mode 100644 index 30e7758..0000000 --- a/packages/u-he/twangstrom.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ stdenv, pkgs, fetchurl, lib, autoPatchelfHook, makeWrapper, ... }: - -stdenv.mkDerivation rec { - pname = "u-he twangstrom"; - version = "latest"; - - src = fetchurl { - url = "https://dl.u-he.com/releases/Twangstrom_102_16742_Linux.tar.xz"; - sha256 = "sha256-SFPY+R+gQstDXe+gLaoIuCUckBoYwWZygXSMwytcpnc="; - }; - - nativeBuildInputs = [ makeWrapper autoPatchelfHook ]; - - buildInputs = with pkgs; [ - freetype - fontconfig - alsa-lib - pipewire - stdenv.cc.cc.lib - cairo - xorg.libxcb - xorg.xcbutilkeysyms - xorg.xcbutil - gtk3 - glibc - batik - ]; - - installPhase = '' - mkdir -p $out/lib/vst3 $out/share $out/lib/vst3/Twangstrom.64.vst3/Contents/Resources/Documentation $out/lib/vst3/Twangstrom.64.vst3/Contents/x86_64-linux - - cp -r Twangstrom/Twangstrom.64.so $out/lib/vst3/Twangstrom.64.vst3/Contents/x86_64-linux/ - cp -r Twangstrom/*.pdf $out/lib/vst3/Twangstrom.64.vst3/Contents/Resources/Documentation/ - - ''; - - # cp -r Twangstrom $out/share/ - - postFixup = '' - for file in \ - $out/lib/vst3/Twangstrom.64.vst3/Contents/x86_64-linux/Twangstrom.64.so - do - patchelf --set-rpath "${lib.makeLibraryPath buildInputs}" $file - done - ''; - - meta = with lib; { - homepage = "https://u-he.com/products/twangstrom/"; - description = "u-he twangstrom. To complete the installation, manually symlink the data dirs from ~/.nix-profile/share/Twangstrom/ into ~/.u-he/Twangstrom/"; - platforms = platforms.linux; - }; -} diff --git a/system/eddie/configuration.nix b/system/eddie/configuration.nix index 9aec4fa..5da1351 100644 --- a/system/eddie/configuration.nix +++ b/system/eddie/configuration.nix @@ -15,7 +15,7 @@ # You can add overlays here overlays = [ # Add overlays your own flake exports (from overlays and pkgs dir): - # outputs.overlays.additions + outputs.overlays.additions outputs.overlays.modifications outputs.overlays.unstable-packages ]; @@ -90,19 +90,6 @@ systemd.services.tailscaled.after = ["NetworkManager-wait-online.service"]; - # nixpkgs.config.packageOverrides = pkgs: { - # openrazer-daemon = pkgs.openrazer-daemon.overrideDerivation (previous: { - # name = "openrazer-daemon390"; - # src = pkgs.fetchFromGitHub { - # owner = "openrazer"; - # repo = "openrazer"; - # hash = "sha256-MLwhqLPWdjg1ZUZP5Sig37RgZEeHlU+DyELpyMif6iY="; - # rev = "ae5791101e39b91518abb16f26978f2f0eea5e03"; - # }; - # # patches = [""]; - # }); - # }; - hardware = { openrazer = { enable = true;