Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Last active March 1, 2024 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coderofsalvation/00434e3c0dad50a4d7086821a80ff882 to your computer and use it in GitHub Desktop.
Save coderofsalvation/00434e3c0dad50a4d7086821a80ff882 to your computer and use it in GitHub Desktop.
Open Cubic Player Nix-file attempt (newbie needs help, this nix-file is stuck on libancient)

Due to lack of nix-skills I gave up on compiling it via nix (and ideally submitting it upstream). For now, I'm just using the AWESOME ocp player via this ~/bin/ocp shellscript:

#!/bin/bash
nix_windows(){
  test -d ~/apps/ocp || {
    mkdir ~/apps/ocp
    cd ~/apps/ocp
    wget "https://github.com/mywave82/opencubicplayer/releases/download/v0.2.107/ocp-windows-32bit-0.2.107.zip"
    unzip ocp-windows*.zip
    rm *.zip
  }
  cd ~/apps/ocp
  nix-shell -p wine --run "wine ocp.exe $*"
}

linux(){
  exec /usr/bin/ocp -fl0,r0 -va300 -dcurses "$*"
  #exec /usr/bin/ocp -fl0,r0 -va300 -dsdl2 "$*"
}

test -n $NIX_PATH && nix_windows "$*"
test -n $NIX_PATH || linux "$*"
{ lib, stdenv, fetchurl }:
let
pkgs = import <nixpkgs> {};
# mkDerivation = import ./autotools.nix pkgs;
in
stdenv.mkDerivation rec {
pname = "ocp";
version = "0.2.107";
version_ancient = "2.1.1";
buildInputs = with pkgs; [
ncurses zlib bzip2 libmad libjpeg libpng libogg libvorbis xa
hexdump perl libdiscid cjson
];
nativeBuildInputs = with pkgs; [ pkg-config unzip ];
src = fetchurl {
url = "https://github.com/mywave82/opencubicplayer/releases/download/v${version}/ocp-${version}.tar.gz";
sha256 = "1aadwlakrxg2xvvg0snm0l418mfkz5sqi78h23m9ljxnw3d8wzb8";
};
ancient = fetchurl {
url = "https://github.com/temisu/ancient/archive/refs/tags/v${version_ancient}.zip";
sha256 = "1yqdn1xrl3qkvvkqc27ariqnb2jki1xn0x3m39k80yszp57ynczg";
};
patchPhase = ''
unzip $ancient
cd ancient-$version_ancient
cat Makefile.unix | grep -v TEST > Makefile.patched
make -f Makefile.patched
find . | grep ancient
echo ancient was build
cd -
return 1
'';
#meta = with lib; {
# description = "Open Cubic Player"
# license = "free";
# sourceProvenance = with sourceTypes; [ binaryNativeCode ];
# homepage = "https://stian.cubic.org/project-ocp.php";
# maintainers = with maintainers; [ your_name ];
# platforms = [ "i686-linux" "x86_64-linux" "x86_64-windows" "i686-windows" "x86_64-darwin" ];
#};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment