wine-bass/flake.nix
2023-03-10 02:23:12 +07:00

116 lines
4.8 KiB
Nix

{
description = "libbass for wine";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devshell.url = "github:numtide/devshell";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, flake-utils, devshell, nixpkgs, flake-compat }:
let
inherit (nixpkgs) lib;
in
flake-utils.lib.eachDefaultSystem (system: {
devShell =
let attrs = {
overlays = [
(import "${devshell.outPath}/overlay.nix")
(_: prev: let
path = if prev.stdenv.hostPlatform.system == "x86_64-linux" then "x86_64" else "x86";
in {
libbass = prev.libbass.overrideAttrs (_: {
version = "2.4.17";
src = prev.fetchurl {
url = "https://www.un4seen.com/files/bass24-linux.zip";
sha256 = "sha256-Ub6kLTJMUkIWiwUzRKZe1JRXFchPku2HReINsz0Wjvk=";
};
installPhase =
''
mkdir -p $out/{lib,include}
install -m644 -t $out/lib/ libs/${path}/libbass.so
install -m644 -t $out/include/ bass.h
'';
});
libbass_fx = prev.libbass_fx.overrideAttrs (_: {
version = "2.4.12.6";
src = prev.fetchurl {
url = "https://www.un4seen.com/files/z/0/bass_fx24-linux.zip";
sha256 = "sha256-Hul2ELwnaDV8TDRMDXoFisle31GATDkf3PdkR2K9QTs=";
};
installPhase = ''
mkdir -p $out/{lib,include}
install -m644 -t $out/lib/ libs/${path}/libbass_fx.so
install -m644 -t $out/include/ C/bass_fx.h
'';
});
})
];
config.allowBroken = true;
config.allowUnsupportedSystem = true;
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"libbass"
"libbass_fx"
];
};
pkgs = import nixpkgs (attrs // {
inherit system;
});
pkgsX86 = import nixpkgs (attrs // {
system = "i686-linux";
});
in
pkgs.devshell.mkShell {
#commands = [
# {
# package = pkgs.devshell.cli;
# help = "Per project developer environments";
# }
#];
devshell.packages = with pkgs; [
gdb
gnumake
pkgsX86.gcc
pkgsX86.alsa-lib
pkgsX86.pipewire
pkgsX86.pulseaudio
pkgsX86.jack2
] ++ (map lib.getDev [
wineWowPackages.stagingFull
libbass
libbass_fx
]);
env = with pkgs; [
{ name = "WINEPREFIX"; eval = "~/wine/osu"; }
{ name = "WINE_DLL_PATH"; eval = "$PRJ_ROOT/dlls"; }
{ name = "WINEDLLPATH"; eval = "$PRJ_ROOT/dlls"; }
{ name = "C_INCLUDE_PATH"; prefix = "$DEVSHELL_DIR/include"; }
{ name = "C_INCLUDE_PATH"; prefix = "$DEVSHELL_DIR/include/wine/windows"; }
{ name = "CPLUS_INCLUDE_PATH"; prefix = "$DEVSHELL_DIR/include"; }
{ name = "CPLUS_INCLUDE_PATH"; prefix = "$DEVSHELL_DIR/include/wine/windows"; }
{ name = "PKG_CONFIG_PATH"; prefix = "$DEVSHELL_DIR/lib/pkgconfig"; }
{ name = "PKG_CONFIG_PATH"; prefix = "$DEVSHELL_DIR/share/pkgconfig"; }
# { name = "LIBRARY_PATH"; prefix = "${lib.getLib libbass}/lib"; }
# { name = "LIBRARY_PATH"; prefix = "${lib.getLib libbass_fx}/lib"; }
# { name = "LD_LIBRARY_PATH"; prefix = "${lib.getLib libbass}/lib"; }
# { name = "LD_LIBRARY_PATH"; prefix = "${lib.getLib libbass_fx}/lib"; }
{ name = "LIBRARY_PATH"; prefix = "${lib.getLib libbass}/lib"; }
{ name = "LIBRARY_PATH"; prefix = "${lib.getLib libbass_fx}/lib"; }
{ name = "LD_LIBRARY_PATH"; prefix = "${lib.getLib libbass}/lib"; }
{ name = "LD_LIBRARY_PATH"; prefix = "${lib.getLib libbass_fx}/lib"; }
{ name = "LIBRARY_PATH"; prefix = "${lib.getLib pkgsX86.libbass}/lib"; }
{ name = "LIBRARY_PATH"; prefix = "${lib.getLib pkgsX86.libbass_fx}/lib"; }
{ name = "LD_LIBRARY_PATH"; prefix = "${lib.getLib pkgsX86.libbass}/lib"; }
{ name = "LD_LIBRARY_PATH"; prefix = "${lib.getLib pkgsX86.libbass_fx}/lib"; }
{ name = "LD_LIBRARY_PATH"; prefix = "${lib.getLib pkgsX86.alsa-lib}/lib"; }
{ name = "LD_LIBRARY_PATH"; prefix = "${lib.getLib pkgsX86.pipewire}/lib"; }
{ name = "LD_LIBRARY_PATH"; prefix = "${lib.getLib pkgsX86.pulseaudio}/lib"; }
];
};
});
}