From 22a34c114b6169b5ff180d53492da3354e05e77e Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sun, 5 Jan 2025 23:05:24 -0800 Subject: [PATCH 1/4] missing polkit things --- modules/polkit.nix | 2 +- modules/system.nix | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/polkit.nix b/modules/polkit.nix index 7129df1..88dbe6b 100644 --- a/modules/polkit.nix +++ b/modules/polkit.nix @@ -1,4 +1,4 @@ -{ +{ pkgs, ... }: { security.polkit = { enable = true; }; diff --git a/modules/system.nix b/modules/system.nix index 78240e8..634b903 100644 --- a/modules/system.nix +++ b/modules/system.nix @@ -6,6 +6,7 @@ ./user ./emacs ./zsh + ./polkit.nix ]; programs.dconf.enable = true; From 187222b1f2068b5ef26af61d130eb6fe8f0e62ec Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sun, 5 Jan 2025 23:17:47 -0800 Subject: [PATCH 2/4] add mcontrolcenter --- modules/overlay-pkgs/default.nix | 1 + modules/overlay-pkgs/mcontrolcenter.nix | 34 +++++++++++++++++++++++++ systems/msi/default.nix | 1 + systems/msi/mcontrolcenter.nix | 18 +++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 modules/overlay-pkgs/mcontrolcenter.nix create mode 100644 systems/msi/mcontrolcenter.nix diff --git a/modules/overlay-pkgs/default.nix b/modules/overlay-pkgs/default.nix index 7fd948a..3e19755 100644 --- a/modules/overlay-pkgs/default.nix +++ b/modules/overlay-pkgs/default.nix @@ -4,6 +4,7 @@ (final: prev: { kwrite = final.kdePackages.callPackage ./kwrite.nix {}; + mcontrolcenter = final.callPackage ./mcontrolcenter.nix {}; }) ]; } diff --git a/modules/overlay-pkgs/mcontrolcenter.nix b/modules/overlay-pkgs/mcontrolcenter.nix new file mode 100644 index 0000000..cfd8e44 --- /dev/null +++ b/modules/overlay-pkgs/mcontrolcenter.nix @@ -0,0 +1,34 @@ +{ + stdenv, + fetchFromGitHub, + cmake, + qt6Packages, +}: stdenv.mkDerivation rec { + pname = "mcontrolcenter"; + version = "0.3.2"; + src = fetchFromGitHub { + owner = "dmitry-s93"; + repo = "mcontrolcenter"; + rev = "957ce6acaf8031a673292607b9fe9713430c94fd"; + sha256 = "z/g+Xrqhbuc/K/7fCcbiJZaj8Re//Bz1JAunxn3szYQ="; + }; + + nativeBuildInputs = with qt6Packages; [ cmake qttools wrapQtAppsHook ]; + buildInputs = with qt6Packages; [ qtbase ]; + + postInstall = '' + mkdir -p $out/share/dbus-1/system-services + + cat < $out/share/dbus-1/system-services/mcontrolcenter.helper.service + [D-BUS Service] + Name=mcontrolcenter.helper + Exec=$out/bin/mcontrolcenter-helper + User=root + END + + mkdir -p $out/share/dbus-1/system.d + cp ${src}/src/helper/mcontrolcenter-helper.conf $out/share/dbus-1/system.d/ + ''; + + meta.mainProgram = "mcontrolcenter"; +} diff --git a/systems/msi/default.nix b/systems/msi/default.nix index 1dfb2b1..7e7bea2 100644 --- a/systems/msi/default.nix +++ b/systems/msi/default.nix @@ -3,6 +3,7 @@ ./hardware.nix ./mullvad.nix ./hyprland + ./mcontrolcenter.nix ]; system.stateVersion = "23.11"; diff --git a/systems/msi/mcontrolcenter.nix b/systems/msi/mcontrolcenter.nix new file mode 100644 index 0000000..a7e8aef --- /dev/null +++ b/systems/msi/mcontrolcenter.nix @@ -0,0 +1,18 @@ +{ lib, pkgs, ... }: { + boot = { + kernelModules = [ "ec_sys" ]; + extraModprobeConfig = '' + options ec_sys write_support=1 + ''; + }; + + environment.systemPackages = [ pkgs.mcontrolcenter ]; + + systemd.user.services.mcontrolcenter = { + description = "Launch mcontrolcenter"; + requires = [ "tray.target" ]; + after = [ "graphical-session-pre.target" "tray.target" ]; + partOf = [ "graphical-session.target" ]; + script = lib.getExe pkgs.mcontrolcenter; + }; +} From 4f6b9c55e1669b40789447813020c3b86b405efe Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sun, 5 Jan 2025 23:21:34 -0800 Subject: [PATCH 3/4] increase alacritty scrollback --- modules/user/config/alacritty.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/user/config/alacritty.nix b/modules/user/config/alacritty.nix index be99c26..e53f28b 100644 --- a/modules/user/config/alacritty.nix +++ b/modules/user/config/alacritty.nix @@ -21,6 +21,8 @@ size = 11; }; + scrolling.history = 100000; + colors = { primary = { background = "#001017"; From 590618a5bcde9aff9916ce6ed8f9d6f77730a605 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sun, 5 Jan 2025 23:24:09 -0800 Subject: [PATCH 4/4] use qt6 cantata fork package pulled from nixpkgs issue --- .../cantata/cantata-projectid.diff | 41 ++++++ modules/overlay-pkgs/cantata/default.nix | 133 ++++++++++++++++++ .../cantata/dont-check-for-perl-in-PATH.diff | 16 +++ modules/overlay-pkgs/default.nix | 3 +- 4 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 modules/overlay-pkgs/cantata/cantata-projectid.diff create mode 100644 modules/overlay-pkgs/cantata/default.nix create mode 100644 modules/overlay-pkgs/cantata/dont-check-for-perl-in-PATH.diff diff --git a/modules/overlay-pkgs/cantata/cantata-projectid.diff b/modules/overlay-pkgs/cantata/cantata-projectid.diff new file mode 100644 index 0000000..7fe2673 --- /dev/null +++ b/modules/overlay-pkgs/cantata/cantata-projectid.diff @@ -0,0 +1,41 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 11fd7d06..5892d19f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -10,8 +10,8 @@ project( + + # NOTE: If PROJECT_URL, or PROJECT_REV_URL, are changed, then cantata-dynamic, README, and + # dbus/mpd.cantata.xml will need renaming/updating. +-set(PROJECT_ID "Cantata.cantata.unix.dog") +-set(PROJECT_REV_ID "dog.unix.cantata.Cantata") ++set(PROJECT_ID "cantata.mpd") ++set(PROJECT_REV_ID "mpd.cantata") + set(EXECUTABLE_NAME "cantata") + + message(STATUS "Configuring ${PROJECT_NAME} v${PROJECT_VERSION}") +diff --git a/cantata.desktop.cmake b/cantata.desktop.cmake +index b6c63f86..72f541e8 100644 +--- a/cantata.desktop.cmake ++++ b/cantata.desktop.cmake +@@ -29,7 +29,7 @@ GenericName[sq]=Clienti player muzike + GenericName[tr]=Muzik Çalıcı İstemcisi + + +-Icon=@PROJECT_REV_ID@ ++Icon=cantata + Exec=@EXECUTABLE_NAME@ + Terminal=false + +diff --git a/gui/trayitem.cpp b/gui/trayitem.cpp +index 8514ba00..2ca34468 100644 +--- a/gui/trayitem.cpp ++++ b/gui/trayitem.cpp +@@ -145,7 +145,7 @@ void TrayItem::setup() + QIcon icon; + icon.addFile(CANTATA_SYS_ICONS_DIR + PROJECT_REV_ID ".png"); + #else +- QIcon icon = QIcon::fromTheme(Utils::Gnome == Utils::currentDe() ? PROJECT_REV_ID "-symbolic" : PROJECT_REV_ID); ++ QIcon icon = QIcon::fromTheme(Utils::Gnome == Utils::currentDe() ? "cantata-symbolic" : "cantata"); + // Bug: 660 If installed to non-standard folder, QIcon::fromTheme does not seem to find icon. Therefore + // add icon files here... + if (icon.isNull()) { diff --git a/modules/overlay-pkgs/cantata/default.nix b/modules/overlay-pkgs/cantata/default.nix new file mode 100644 index 0000000..448b8bc --- /dev/null +++ b/modules/overlay-pkgs/cantata/default.nix @@ -0,0 +1,133 @@ +{ stdenv +, lib +, fetchFromGitHub +, cmake +, pkg-config +, qtbase +, qtsvg +, qttools +, qtwayland +, wrapQtAppsHook +, perl + + # Cantata doesn't build with cdparanoia enabled so we disable that + # default for now until I (or someone else) figure it out. +, withCdda ? false +, cdparanoia +, withCddb ? false +, libcddb +, withLame ? false +, lame +, withMusicbrainz ? false +, libmusicbrainz5 + +, withTaglib ? true +, taglib +, taglib_extras +, withHttpStream ? true +, qtmultimedia +, gst_all_1 +, withReplaygain ? true +, ffmpeg +, speex +, mpg123 +, withMtp ? true +, libmtp +, withOnlineServices ? true +, withDevices ? true +, udisks2 +, withDynamic ? true +, withHttpServer ? true +, withLibVlc ? false #true +, libvlc +, withStreams ? true +}: + +# Inter-dependencies. +assert withCddb -> withCdda && withTaglib; +assert withCdda -> withCddb && withMusicbrainz; +assert withLame -> withCdda && withTaglib; +assert withMtp -> withTaglib; +assert withMusicbrainz -> withCdda && withTaglib; +assert withOnlineServices -> withTaglib; +assert withReplaygain -> withTaglib; +assert withLibVlc -> withHttpStream; + +let + fstat = x: fn: + "-DENABLE_${fn}=${if x then "ON" else "OFF"}"; + + withUdisks = (withTaglib && withDevices); + + gst = with gst_all_1; [ gstreamer gst-libav gst-plugins-base gst-plugins-good gst-plugins-bad ]; + + options = [ + { names = [ "CDDB" ]; enable = withCddb; pkgs = [ libcddb ]; } + { names = [ "CDPARANOIA" ]; enable = withCdda; pkgs = [ cdparanoia ]; } + { names = [ "DEVICES_SUPPORT" ]; enable = withDevices; pkgs = [ ]; } + { names = [ "DYNAMIC" ]; enable = withDynamic; pkgs = [ ]; } + { names = [ "FFMPEG" "MPG123" "SPEEXDSP" ]; enable = withReplaygain; pkgs = [ ffmpeg speex mpg123 ]; } + { names = [ "HTTPS_SUPPORT" ]; enable = true; pkgs = [ ]; } + { names = [ "HTTP_SERVER" ]; enable = withHttpServer; pkgs = [ ]; } + { names = [ "HTTP_STREAM_PLAYBACK" ]; enable = withHttpStream; pkgs = [ qtmultimedia ]; } + { names = [ "LAME" ]; enable = withLame; pkgs = [ lame ]; } + { names = [ "LIBVLC" ]; enable = withLibVlc; pkgs = [ libvlc ]; } + { names = [ "MTP" ]; enable = withMtp; pkgs = [ libmtp ]; } + { names = [ "MUSICBRAINZ" ]; enable = withMusicbrainz; pkgs = [ libmusicbrainz5 ]; } + { names = [ "ONLINE_SERVICES" ]; enable = withOnlineServices; pkgs = [ ]; } + { names = [ "STREAMS" ]; enable = withStreams; pkgs = [ ]; } + { names = [ "TAGLIB" "TAGLIB_EXTRAS" ]; enable = withTaglib; pkgs = [ taglib taglib_extras ]; } + { names = [ "UDISKS2" ]; enable = withUdisks; pkgs = [ udisks2 ]; } + ]; + +in +stdenv.mkDerivation rec { + pname = "cantata"; + version = "3.2.1"; + + src = fetchFromGitHub { + owner = "nullobsi"; + repo = "cantata"; + rev = "1ced66aaf82dad2137c01e887a88c10a4269467e"; + sha256 = "NLHkX9kZeb0ED48I6qOajj2/e9rsGbtLX9+BSzG00tI="; + }; + + patches = [ + # Cantata wants to check if perl is in the PATH at runtime, but we + # patchShebangs the playlists scripts, making that unnecessary (perl will + # always be available because it's a dependency) + ./dont-check-for-perl-in-PATH.diff + ./cantata-projectid.diff + ]; + + postPatch = '' + patchShebangs playlists + ''; + + buildInputs = [ + qtbase + qtsvg + qtwayland + (perl.withPackages (ppkgs: with ppkgs; [ URI ])) + ] + ++ lib.flatten (builtins.catAttrs "pkgs" (builtins.filter (e: e.enable) options)); + + nativeBuildInputs = [ cmake pkg-config qttools wrapQtAppsHook ]; + + cmakeFlags = lib.flatten (map (e: map (f: fstat e.enable f) e.names) options); + + qtWrapperArgs = lib.optionals (withHttpStream && !withLibVlc) [ + "--prefix GST_PLUGIN_PATH : ${lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" gst}" + ]; + + meta = with lib; { + description = "Graphical client for MPD"; + mainProgram = "cantata"; + homepage = "https://github.com/cdrummond/cantata"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ peterhoeg ]; + # Technically, Cantata runs on Darwin/Windows so if someone wants to + # bother figuring that one out, be my guest. + platforms = platforms.linux; + }; +} diff --git a/modules/overlay-pkgs/cantata/dont-check-for-perl-in-PATH.diff b/modules/overlay-pkgs/cantata/dont-check-for-perl-in-PATH.diff new file mode 100644 index 0000000..a8520ab --- /dev/null +++ b/modules/overlay-pkgs/cantata/dont-check-for-perl-in-PATH.diff @@ -0,0 +1,16 @@ +diff --git a/playlists/dynamicplaylists.cpp b/playlists/dynamicplaylists.cpp +index b85e93b5..3c29f775 100644 +--- a/playlists/dynamicplaylists.cpp ++++ b/playlists/dynamicplaylists.cpp +@@ -205,11 +205,6 @@ void DynamicPlaylists::start(const QString& name) + return; + } + +- if (Utils::findExe("perl").isEmpty()) { +- emit error(tr("You need to install \"perl\" on your system in order for Cantata's dynamic mode to function.")); +- return; +- } +- + QString fName(Utils::dataDir(rulesDir, false) + name + constExtension); + + if (!QFile::exists(fName)) { \ No newline at end of file diff --git a/modules/overlay-pkgs/default.nix b/modules/overlay-pkgs/default.nix index 3e19755..7e7fe62 100644 --- a/modules/overlay-pkgs/default.nix +++ b/modules/overlay-pkgs/default.nix @@ -1,10 +1,11 @@ -{ inputs, ... }: { +{ inputs, pkgs, ... }: { nixpkgs.overlays = [ inputs.nur.overlay (final: prev: { kwrite = final.kdePackages.callPackage ./kwrite.nix {}; mcontrolcenter = final.callPackage ./mcontrolcenter.nix {}; + cantata = final.qt6Packages.callPackage ./cantata {}; }) ]; }