Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stats: build from source #333546

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pkgs/by-name/st/stats/0001-Fixup-MARKETING_VERSION.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Stats.xcodeproj/project.pbxproj b/Stats.xcodeproj/project.pbxproj
index d7cb8ae1..44821cf9 100644
--- a/Stats.xcodeproj/project.pbxproj
+++ b/Stats.xcodeproj/project.pbxproj
@@ -1968,7 +1968,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "MARKETING_VERSION=$(/usr/libexec/PlistBuddy -c 'print :objects:9A141107229E721200D29793:buildSettings:MARKETING_VERSION' \"$(PWD)/Stats.xcodeproj/project.pbxproj\")\n/usr/libexec/PlistBuddy -c \"Set :CFBundleShortVersionString $MARKETING_VERSION\" \"$(PWD)/Widgets/Supporting Files/Info.plist\"\nBUNDLE_VERSION=$(/usr/libexec/PlistBuddy -c \"Print CFBundleVersion\" \"$(PWD)/Stats/Supporting Files/Info.plist\")\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $BUNDLE_VERSION\" \"$(PWD)/Widgets/Supporting Files/Info.plist\"\n";
+ shellScript = "MARKETING_VERSION=$(PlistBuddy -c 'print :objects:9A141107229E721200D29793:buildSettings:MARKETING_VERSION' \"${PWD}/Stats.xcodeproj/project.pbxproj\")\nPlistBuddy -c \"Set :CFBundleShortVersionString $MARKETING_VERSION\" \"${PWD}/Widgets/Supporting Files/Info.plist\"\nBUNDLE_VERSION=$(PlistBuddy -c \"Print CFBundleVersion\" \"${PWD}/Stats/Supporting Files/Info.plist\")\nPlistBuddy -c \"Set :CFBundleVersion $BUNDLE_VERSION\" \"${PWD}/Widgets/Supporting Files/Info.plist\"\n";
};
9A88E2672659002E00E2B7B0 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
53 changes: 35 additions & 18 deletions pkgs/by-name/st/stats/package.nix
Original file line number Diff line number Diff line change
@@ -1,41 +1,58 @@
{
lib,
stdenvNoCC,
fetchurl,
undmg,
stdenv,
fetchFromGitHub,
xcbuild,
swift,
swiftPackages,
nix-update-script,
}:

stdenvNoCC.mkDerivation (finalAttrs: {
stdenv.mkDerivation (finalAttrs: {
pname = "stats";
version = "2.11.4";
version = "2.11.5";

src = fetchurl {
url = "https://github.com/exelban/stats/releases/download/v${finalAttrs.version}/Stats.dmg";
hash = "sha256-Cm5gu+rL3eerAOnNcNUL2MlXsxV2jMiJLwgGtskIVP4=";
src = fetchFromGitHub {
owner = "exelban";
repo = "Stats";
rev = "v${finalAttrs.version}";
sha256 = "sha256-SLI0qcSfDHQj6tsKXF1RSwYWZxAQurgw7AYGV009aRQ=";
};

sourceRoot = ".";
nativeBuildInputs = [
xcbuild
swiftPackages.swift-docc
];

nativeBuildInputs = [ undmg ];
buildPhase = ''
runHook preBuild

installPhase = ''
runHook preInstall
export SWIFT_LIBRARY_PATH=${swift.swift.lib}/${swift.swiftModuleSubdir}

mkdir -p $out/Applications
cp -r *.app $out/Applications
xcodebuild \
-scheme Stats \
-destination 'platform=macOS' \
-configuration Release build CODE_SIGNING_ALLOWED=NO \
-derivedDataPath "$(pwd)/build"

runHook postInstall
mkdir -p "$out/Applications"
cp -R "./build/Build/Products/Release/Stats.app" "$out/Applications/Stats.app"

runHook postBuild
'';

patches = [ ./0001-Fixup-MARKETING_VERSION.patch ];

passthru.updateScript = nix-update-script { };

meta = {
description = "macOS system monitor in your menu bar";
homepage = "https://github.com/exelban/stats";
homepage = "https://github.com/exelban/Stats";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ donteatoreo emilytrau ];
maintainers = with lib.maintainers; [
donteatoreo
emilytrau
];
platforms = lib.platforms.darwin;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
})