From 96ffd97ac643953304b429694d88bc8ce70e04ec Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 4 Jan 2020 00:07:20 -0500 Subject: [PATCH] Replace modules/audio/* with daw module And add custom lmms package, since the upstream is currently broken (NixOS/nixpkgs#76074). --- modules/audio/audacity.nix | 7 ------- modules/audio/lmms.nix | 7 ------- modules/audio/spotify.nix | 37 --------------------------------- modules/daw.nix | 18 ++++++++++++++++ packages/lmms.nix | 42 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 51 deletions(-) delete mode 100644 modules/audio/audacity.nix delete mode 100644 modules/audio/lmms.nix delete mode 100644 modules/audio/spotify.nix create mode 100644 modules/daw.nix create mode 100644 packages/lmms.nix diff --git a/modules/audio/audacity.nix b/modules/audio/audacity.nix deleted file mode 100644 index 62d81513..00000000 --- a/modules/audio/audacity.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - audacity - ]; -} diff --git a/modules/audio/lmms.nix b/modules/audio/lmms.nix deleted file mode 100644 index bd3f8e19..00000000 --- a/modules/audio/lmms.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - lmms - ]; -} diff --git a/modules/audio/spotify.nix b/modules/audio/spotify.nix deleted file mode 100644 index 7b22525d..00000000 --- a/modules/audio/spotify.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - # services.spotifyd doesn't work so we'll have to roll our own spotifyd + - # spotify-tui solution. I can't get the dbus interface doesn't work, though, - # so we have to wait for spotify-tui to implement CLI command for controlling - # spotify playback (see https://github.com/Rigellute/spotify-tui/issues/147) - # or for spotifyd to get fixed. - environment.systemPackages = with pkgs; [ - unstable.spotifyd - (writeScriptBin "spt" '' - #!${stdenv.shell} - if ! systemctl --user is-active spotifyd >/dev/null; then - systemctl --user start spotifyd - fi - ${unstable.spotify-tui}/bin/spt - '') - - # spotify-tui is fine for selecting and playing music, but incomplete. We - # occasionally still need the official client for more sophisticated search - # and the "made for you" playlists. - spotify - ]; - - systemd.user.services.spotifyd.serviceConfig = - let spotifydConf = pkgs.writeText "spotifyd.conf" '' - [global] - username = accounts@v0.io - password_cmd = ${pkgs.pass}/bin/pass www/spotify.com | head -n1 - backend = pulseaudio - ''; - in { - ExecStart = "${pkgs.unstable.spotifyd}/bin/spotifyd --no-daemon --cache-path /tmp/spotifyd --config-path ${spotifydConf}"; - Restart = "always"; - RestartSec = 6; - }; -} diff --git a/modules/daw.nix b/modules/daw.nix new file mode 100644 index 00000000..7f09520f --- /dev/null +++ b/modules/daw.nix @@ -0,0 +1,18 @@ +# I make music for my games. LMMS is my DAW. Fruityloops too, on my Windows +# system, but I'm slowly phasing it out for open-source alternatives. When I'm +# in the mood for a quick chiptune, I fire up sunvox instead -- it runs +# absolutely anywhere, even on my ipad and phone. + +{ config, lib, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + audacity # for recording and remastering audio + # lmms # for making music + sunvox # for making music (where LMMS is overkill) + + # Build our own LMMS because the built-in nixpkg is broken, due to a 'Could + # not find the Qt platform plugin "xcb" in ""' error on startup: + # https://github.com/NixOS/nixpkgs/issues/76074 + (callPackage {}) + ]; +} diff --git a/packages/lmms.nix b/packages/lmms.nix new file mode 100644 index 00000000..14b16f62 --- /dev/null +++ b/packages/lmms.nix @@ -0,0 +1,42 @@ +{ appimageTools, fetchurl, lib, gsettings-desktop-schemas, gtk3, makeDesktopItem }: + +let pname = "lmms"; + version = "1.2.1"; + desktopItem = makeDesktopItem { + name = pname; + desktopName = "LMMS"; + comment = "Cross-platform music production software"; + icon = "lmms"; + terminal = "false"; + exec = pname; + categories = "Audio"; + }; +in appimageTools.wrapType2 rec { + name = "${pname}-${version}"; + src = fetchurl { + url = "https://github.com/LMMS/lmms/releases/download/v${version}/${name}-linux-x86_64.AppImage"; + sha256 = "0aa63c3fv84wrny7vp7ycdvapp21j09kllzs1xybb19wdkdd863v"; + }; + + profile = '' + export LC_ALL=C.UTF-8 + export XDG_DATA_DIRS=${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS + ''; + + extraPkgs = p: (appimageTools.defaultFhsEnvArgs.multiPkgs p); + extraInstallCommands = '' + mv $out/bin/{${name},${pname}} + chmod +x $out/bin/${pname} + mkdir -p "$out/share/applications/" + cp "${desktopItem}"/share/applications/* "$out/share/applications/" + substituteInPlace $out/share/applications/*.desktop --subst-var out + ''; + + meta = with lib; { + description = "Cross-platform music production software"; + homepage = https://lmms.io; + license = licenses.gpl2Plus; + platforms = [ "x86_64-linux" "i686-linux" ]; + maintainers = with maintainers; [ hlissner ]; + }; +}