psst: add darwin support; unstable-2024-10-24 -> 0-unstable-2025-02-22 (#359804)

This commit is contained in:
Samuel Ainsworth
2025-03-11 18:43:29 -04:00
committed by GitHub
4 changed files with 62 additions and 5740 deletions
-5656
View File
File diff suppressed because it is too large Load Diff
@@ -58,7 +58,7 @@ index 2faa317..b890a2d 100644
-pub const GIT_VERSION: &str = git_version!();
-pub const BUILD_TIME: &str = include!(concat!(env!("OUT_DIR"), "/build-time.txt"));
-pub const REMOTE_URL: &str = include!(concat!(env!("OUT_DIR"), "/remote-url.txt"));
+pub const GIT_VERSION: &str = "02923198ba0e27b2b6271340cf57dd8ce109049b";
+pub const GIT_VERSION: &str = "";
+pub const BUILD_TIME: &str = "1970-01-01 00:00:00";
+pub const REMOTE_URL: &str = "https://github.com/jpochyla/psst";
+61 -40
View File
@@ -1,53 +1,72 @@
{ lib, fetchFromGitHub, rustPlatform, alsa-lib, atk, cairo, dbus, gdk-pixbuf, glib, gtk3, pango, pkg-config, makeDesktopItem }:
{
alsa-lib,
atk,
cairo,
dbus,
fetchFromGitHub,
gdk-pixbuf,
glib,
gtk3,
lib,
libclang,
makeDesktopItem,
nix-update-script,
pango,
pkg-config,
rustPlatform,
stdenv,
}:
let
desktopItem = makeDesktopItem {
name = "Psst";
exec = "psst-gui";
comment = "Fast and multi-platform Spotify client with native GUI";
categories = [
"Audio"
"AudioVideo"
];
comment = "Spotify client with native GUI written in Rust, without Electron";
desktopName = "Psst";
type = "Application";
categories = [ "Audio" "AudioVideo" ];
exec = "psst-gui %U";
icon = "psst";
terminal = false;
name = "Psst";
startupWMClass = "psst-gui";
};
in
rustPlatform.buildRustPackage rec {
rustPlatform.buildRustPackage {
pname = "psst";
version = "unstable-2024-10-24";
version = "0-unstable-2025-02-22";
src = fetchFromGitHub {
owner = "jpochyla";
repo = pname;
rev = "02923198ba0e27b2b6271340cf57dd8ce109049b";
hash = "sha256-gEK0yf37eREsI6kCIYTBlkkM6Fnjy0KGnd0XqcawGjU=";
repo = "psst";
rev = "dd47c302147677433d70b398b1bcd7f1ade87638";
hash = "sha256-EMjY8Tu+ssO30dD2qsvi3FAkt/UlXwM/ss2/FcyNNgI=";
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"cubeb-0.13.0" = "sha256-l1JkKlq2qvvLwNLJ2DrIpAFYcRQyd6F8pAflmtnaXhU=";
"druid-0.8.3" = "sha256-hTB9PQf2TAhcLr64VjjQIr18mczwcNogDSRSN5dQULA=";
"druid-enums-0.1.0" = "sha256-KJvAgKxicx/g+4QRZq3iHt6MGVQbfOpyN+EhS6CyDZk=";
};
};
useFetchCargoVendor = true;
cargoHash = "sha256-0UllCmIe6oEl2Ecl4nqSk9ODdgso5ucX8T5nG3dVwbE=";
# specify the subdirectory of the binary crate to build from the workspace
buildAndTestSubdir = "psst-gui";
env = {
LIBCLANG_PATH = "${lib.getLib libclang}/lib";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [
alsa-lib
atk
cairo
dbus
gdk-pixbuf
glib
gtk3
pango
];
buildInputs =
[
atk
cairo
gdk-pixbuf
glib
gtk3
pango
]
++ lib.optionals stdenv.hostPlatform.isLinux [
alsa-lib
dbus
];
patches = [
# Use a fixed build time, hard-code upstream URL instead of trying to read `.git`
@@ -55,19 +74,21 @@ rustPlatform.buildRustPackage rec {
];
postInstall = ''
install -Dm444 psst-gui/assets/logo_512.png $out/share/icons/hicolor/512x512/apps/${pname}.png
install -Dm444 -t $out/share/applications ${desktopItem}/share/applications/*
install -Dm644 psst-gui/assets/logo_512.png -t $out/share/icons/hicolor/512x512/apps/psst.png
install -Dm644 ${desktopItem}/share/applications/* -t $out/share/applications
'';
passthru = {
updateScript = ./update.sh;
};
passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch" ]; };
meta = with lib; {
description = "Fast and multi-platform Spotify client with native GUI";
meta = {
description = "Spotify client with native GUI written in Rust, without Electron";
homepage = "https://github.com/jpochyla/psst";
license = licenses.mit;
maintainers = with maintainers; [ vbrandl peterhoeg ];
license = lib.licenses.mit;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [
vbrandl
peterhoeg
];
mainProgram = "psst-gui";
};
}
-43
View File
@@ -1,43 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p wget nix-prefetch-github jq coreutils
# shellcheck shell=bash
if [ -n "$GITHUB_TOKEN" ]; then
TOKEN_ARGS=(--header "Authorization: token $GITHUB_TOKEN")
fi
if [[ $# -gt 1 || $1 == -* ]]; then
echo "Regenerates packaging data for psst."
echo "Usage: $0 [git commit]"
exit 1
fi
set -x
cd "$(dirname "$0")"
rev="$1"
set -euo pipefail
if [ -z "$rev" ]; then
rev="$(wget -O- "${TOKEN_ARGS[@]}" "https://api.github.com/repos/jpochyla/psst/commits?per_page=1" | jq -r '.[0].sha')"
fi
date="$(wget -O- "${TOKEN_ARGS[@]}" "https://api.github.com/repos/jpochyla/psst/commits/$rev" | jq -r '.commit.author.date' | cut -dT -f1)"
version="unstable-$date"
# Sources
src_hash=$(nix-prefetch-github jpochyla psst --rev "$rev" | jq -r .hash)
# Cargo.lock
src="https://raw.githubusercontent.com/jpochyla/psst/$rev"
wget "${TOKEN_ARGS[@]}" "$src/Cargo.lock" -O Cargo.lock
sed -i -E -e "s#version = \".*\"#version = \"$version\"#" default.nix
sed -i -E -e "s#rev = \".*\"#rev = \"$rev\"#" default.nix
sed -i -E -e "s#hash = \".*\"#hash = \"$src_hash\"#" default.nix
# Also update the git hash shown in the UI
sed -i -E -e "s#GIT_VERSION: \&str = \".*\"#GIT_VERSION: \&str = \"$rev\"#" make-build-reproducible.patch