Skip to content

armgit / Spun

Public Imported from GitHub
0

A CD-shaped music player for Linux, with local playback and Cider integration.

Complete Nix runtime packaging and pin dependencies

yappologistic45eecee095df
diff --git a/.gitignore b/.gitignore
index 86bf30e..7234b06 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,7 +36,8 @@
!/assets/icons/
/assets/icons/*
!/assets/icons/*.svg
-!flake.nix
+!/flake.nix
+!/flake.lock
# Never publish credentials, private state, editor backups or generated caches.
.env*
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 86022e0..42f39df 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,7 +57,8 @@ if(TARGET Qt6::Quick3D AND SPUN_ENABLE_3D)
target_compile_definitions(spun_core PUBLIC SPUN_WITH_3D=1)
set(SPUN_3D_QML qml/Player3D.qml qml/Recorder3D.qml qml/Tx6_3D.qml qml/Tx6Cable3D.qml qml/Vinyl3D.qml qml/Cassette3D.qml qml/Cd3D.qml)
endif()
-target_compile_definitions(spun_core PUBLIC SPUN_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
+set(SPUN_DEMO_FILE "${CMAKE_CURRENT_SOURCE_DIR}/assets/First-Light.flac" CACHE FILEPATH "Installed or source demo audio file")
+target_compile_definitions(spun_core PUBLIC SPUN_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" SPUN_DEMO_FILE="${SPUN_DEMO_FILE}")
target_compile_options(spun_core PRIVATE -Wall -Wextra -Wpedantic)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
# Keep Release code compact without changing floating-point semantics or
diff --git a/README.md b/README.md
index d73f17a..ca8634d 100644
--- a/README.md
+++ b/README.md
@@ -50,6 +50,23 @@ You need a C++20 compiler, CMake 3.22+, Ninja, pkg-config, Python 3, Qt 6.8+ wit
</details>
+<details>
+<summary>Nix and NixOS</summary>
+
+With Nix flakes enabled, run from the cloned source folder:
+
+```bash
+NIXPKGS_ALLOW_UNFREE=1 nix run --impure .
+# Build without launching:
+NIXPKGS_ALLOW_UNFREE=1 nix build --impure .
+# Development tools:
+nix develop
+```
+
+The license is noncommercial, so Nix requires an explicit unfree-package opt-in. The flake supports x86_64 and aarch64 Linux. NixOS configurations can add `spun.packages.${pkgs.stdenv.hostPlatform.system}.default` to `environment.systemPackages` after adding Spun as a flake input and allowing the `spun` package with `nixpkgs.config.allowUnfreePredicate`. Wayland and X11 plugins are included; no display backend is forced.
+
+</details>
+
## Start listening
**Local music:** choose **Local**, then **+** to add tracks, or drop files and folders onto Spun. **More → Add music folder** includes artist and album subfolders. Imports show progress, skip songs already in the queue and can be cancelled without adding a partial import. Directory symlinks inside the folder are not followed. Your music files are not copied or modified. **More → Play demo** plays the included original soundcheck.
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..d8e842c
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,61 @@
+{
+ "nodes": {
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1731533236,
+ "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1789006805,
+ "narHash": "sha256-xB8mKMOx1IA9vTDNLmJZ6n4wCMq/cuWBBOzGCRnqxrU=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "8ce4ef6cb6f871616146b9fe26d2a5ae594e94fe",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
index 26d3a48..ef369ce 100644
--- a/flake.nix
+++ b/flake.nix
@@ -12,7 +12,7 @@
nixpkgs,
flake-utils,
}:
- flake-utils.lib.eachDefaultSystem (
+ flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
@@ -23,13 +23,14 @@
pname = "spun";
version = "0.1.0";
- src = ./.;
+ src = pkgs.lib.cleanSource ./.;
nativeBuildInputs = [
pkgs.cmake
pkgs.ninja
pkgs.pkg-config
pkgs.python3
+ pkgs.copyDesktopItems
qt6.wrapQtAppsHook
];
@@ -38,6 +39,7 @@
qt6.qtdeclarative
qt6.qtmultimedia
qt6.qtsvg
+ qt6.qtwayland
qt6.qtquick3d
pkgs.taglib
];
@@ -46,18 +48,38 @@
"-DCMAKE_BUILD_TYPE=Release"
"-DBUILD_TESTING=OFF"
"-DSPUN_ENABLE_3D=ON"
+ "-DSPUN_DEMO_FILE=${placeholder "out"}/share/spun/First-Light.flac"
];
installPhase = ''
runHook preInstall
install -Dm755 spun "$out/bin/spun"
+ install -Dm644 ../assets/First-Light.flac "$out/share/spun/First-Light.flac"
+ install -Dm644 ../assets/spun-icon.png "$out/share/icons/hicolor/512x512/apps/spun.png"
+ install -Dm644 ../LICENSE "$out/share/licenses/spun/LICENSE"
+ install -Dm644 ../NOTICE "$out/share/licenses/spun/NOTICE"
runHook postInstall
'';
+ desktopItems = [ (pkgs.makeDesktopItem {
+ name = "spun";
+ desktopName = "Spun";
+ comment = "Play local music or control Cider";
+ exec = "spun %U";
+ icon = "spun";
+ categories = [ "AudioVideo" "Audio" "Player" ];
+ terminal = false;
+ }) ];
+
meta = {
description = "A CD-shaped music player for Linux, with local playback and Cider integration";
homepage = "https://github.com/yappologistic/Spun";
- license = pkgs.lib.licenses.unfree; # PolyForm Noncommercial 1.0.0
+ license = {
+ fullName = "PolyForm Noncommercial 1.0.0";
+ spdxId = "PolyForm-Noncommercial-1.0.0";
+ url = "https://polyformproject.org/licenses/noncommercial/1.0.0/";
+ free = false;
+ };
platforms = pkgs.lib.platforms.linux;
mainProgram = "spun";
};
@@ -73,13 +95,10 @@
qt6.qtdeclarative
qt6.qtmultimedia
qt6.qtsvg
+ qt6.qtwayland
qt6.qtquick3d
pkgs.taglib
];
-
- shellHook = ''
- export QT_QPA_PLATFORM=xcb
- '';
};
}
);
diff --git a/src/player.cpp b/src/player.cpp
index 9ce8288..004ae66 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -450,7 +450,7 @@ void Player::setCover(const QUrl &url) {
m_tracks[m_index].cover = url.toLocalFile();
loadArt(); emit queueChanged(); save();
}
-void Player::demo() { addUrls({QUrl::fromLocalFile(QStringLiteral(SPUN_SOURCE_DIR "/assets/First-Light.flac"))}); }
+void Player::demo() { addUrls({QUrl::fromLocalFile(QStringLiteral(SPUN_DEMO_FILE))}); }
void Player::setVolume(double value) {
value = qBound(0., value, 1.);
if (m_volume == value) return;