opencubicplayer
opencubicplayer copied to clipboard
ocp.nix (help wanted)
I didn't find ocp in https://search.nixos.org which is fine, because I can just run it via wine. However, I still tried to come up with a nix-file to build it, but I got stuck on libancient (which is the only lib which is not in the nix-repos).
If you are a nix-developer and you're reading this...then you're very welcome to help out to complete this nix-definition:
https://gist.github.com/coderofsalvation/00434e3c0dad50a4d7086821a80ff882
It would probably be more clean to add two packages, libancient as a separate package, and then ocp that depends on libancient.
Probably should add alsa-lib as a dependency also.
Here's a flake I made:
flake.nix
{
description = "Open Cubic Player";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
patched-libdiscid = pkgs.libdiscid.overrideAttrs {
patches = [
(pkgs.fetchpatch {
# Without this patch, ocp will give the runtime error:
# undefined symbol: discid_get_id
# Only affects libdiscid v0.6.3 & v0.6.4 (current)
name = "fix-missing-libdir.patch";
url = "https://github.com/metabrainz/libdiscid/commit/b89c14599fd8798eef64431bb05e8705aaaea683.diff";
hash = "sha256-jqIliHBQrb3Mm8EBZgpfWci23/d5gK0af3yi21hYr44=";
})
];
};
in
{
devShells = rec {
ocp = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.ocp ];
};
default = ocp;
};
packages = rec {
libancient = pkgs.stdenv.mkDerivation {
name = "libancient";
src = pkgs.fetchFromGitHub {
owner = "temisu";
repo = "ancient";
rev = "v2.1.1";
hash = "sha256-94YQO+tUcHtmSwOKn5lkSqXwCkDOb0Kcg5aZV7Bxgdc=";
};
nativeBuildInputs = with pkgs; [
autoreconfHook
pkg-config
autoconf-archive
];
};
ocp = pkgs.stdenv.mkDerivation {
name = "ocp";
src = pkgs.fetchFromGitHub {
owner = "mywave82";
repo = "opencubicplayer";
rev = "v0.2.109";
fetchSubmodules = true;
hash = "sha256-5jWDcZQzBne2XGKtXn25eQ4dg3GfHfOCHEBFZgY1S28=";
};
nativeBuildInputs = with pkgs; [
pkg-config
hexdump
perl
];
buildInputs = with pkgs; [
self.packages.${system}.libancient
patched-libdiscid
# Situation with alsa plugins is messy
# On non-NixOS this probably needs an override to find libasound_module_pcm_pipewire.so
# https://github.com/NixOS/nixpkgs/pull/277180
alsa-lib-with-plugins
cjson
desktop-file-utils
freetype
flac
ncurses
SDL2
xa
libgme
libmad
libjpeg
libpng
libvorbis
shared-mime-info
bzip2
zlib
];
configureFlags = [
"--with-builtin=core"
"--with-unifont-otf=${pkgs.unifont}/share/fonts/opentype/unifont.otf"
"--with-unifont-upper-otf=${pkgs.unifont_upper}/share/fonts/opentype/unifont_upper.otf"
"--without-unifont-csur-ttf"
"--without-unifont-csur-otf"
"--without-update-desktop-database"
];
};
default = ocp;
};
});
}
flake.lock
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1712163089,
"narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "fd281bd6b7d3e32ddfa399853946f782553163b5",
"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
}
thanks! trying it right now