Nix expr: Add `libGL` to `buildInputs` on NixOS

currently `libGL.so.1` just happens to be in the closure via `cairo`, but that's no longer the case in Nixpkgs 23.11
This commit is contained in:
James Groom 2023-12-02 18:40:22 +00:00 committed by GitHub
parent 2a40b172e1
commit 7ee28c1ab9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 9 deletions

View File

@ -207,6 +207,7 @@ in {
hasFFmpegPatch_e68a49aa5 = isVersionAtLeast "2.9.2" version; # with e68a49aa5, downloading *and running* FFmpeg finally works; TODO use FFmpeg from Nixpkgs since it's a stable version (4.4.1)
hasMiscTypeCheckerPatch_6afb3be98 = isVersionAtLeast "2.6.2" version;
neededExtraManagedDeps = neededExtraManagedDepsApprox;
needsLibGLVND = false; # true iff not using nixGL (i.e. on NixOS) AND using the OpenGL renderer (the default option)
needsSDL = isVersionAtLeast "2.9.2" version;
nugetDeps = ./deps.nix;
packageScriptNeeds7Zip = !isVersionAtLeast "2.6.3" version;

View File

@ -16,6 +16,7 @@
# makedeps
, git
# rundeps
, libGL
, lua
, mono
, monoBasic
@ -63,7 +64,7 @@
};
genDepsHostTargetFor = { hawkSourceInfo, mono' ? mono }: [ lua mono' openal (lib.getOutput "out" zstd) ]
++ lib.optionals hawkSourceInfo.needsSDL [ SDL2 (lib.getOutput "out" udev) ]
;
++ lib.optional hawkSourceInfo.needsLibGLVND (lib.getOutput "out" libGL);
/**
* see splitReleaseArtifact re: outputs
* and no you can't build only DiscoHawk and its deps; deal with it
@ -224,6 +225,7 @@
buildInstallable' =
{ hawkSourceInfo
, bizhawkAssemblies
, forNixOS
, pname
, launchScriptAttrName
, desktopName
@ -233,7 +235,7 @@
then lib.traceIf (hawkSourceInfo != null) "`hawkSourceInfo` passed to `build{EmuHawk,DiscoHawk}InstallableFor` will be ignored in favour of `bizhawkAssemblies.hawkSourceInfo`"
bizhawkAssemblies
else assert lib.assertMsg (hawkSourceInfo != null) "must pass either `hawkSourceInfo` or `bizhawkAssemblies` to `build{EmuHawk,DiscoHawk}InstallableFor`";
buildAssembliesFor hawkSourceInfo;
buildAssembliesFor (lib.optionalAttrs forNixOS { needsLibGLVND = true; } // hawkSourceInfo);
in buildInstallable {
inherit desktopName pname;
bizhawkAssemblies = bizhawkAssembliesFinal;
@ -287,10 +289,11 @@ in {
buildDiscoHawkInstallableFor =
{ bizhawkAssemblies ? null
, hawkSourceInfo ? null
, forNixOS ? true # currently only adds Mesa to buildInputs, and DiscoHawk doesn't need that, but it's propagated through here so the asms derivation can be shared between it and EmuHawk
, desktopName ? "DiscoHawk (Mono Runtime)"
, desktopIcon ? null
}: buildInstallable' {
inherit bizhawkAssemblies desktopIcon desktopName hawkSourceInfo;
inherit bizhawkAssemblies desktopIcon desktopName forNixOS hawkSourceInfo;
pname = "discohawk-monort";
launchScriptAttrName = "discohawk";
};
@ -301,7 +304,7 @@ in {
, desktopName ? "EmuHawk (Mono Runtime)"
, desktopIcon ? null
}: buildInstallable' {
inherit bizhawkAssemblies desktopIcon desktopName hawkSourceInfo;
inherit bizhawkAssemblies desktopIcon desktopName forNixOS hawkSourceInfo;
pname = "emuhawk-monort";
launchScriptAttrName = if forNixOS then "emuhawk" else "emuhawkNonNixOS";
};

View File

@ -30,6 +30,7 @@ in {
, git ? pkgs.gitMinimal # only when building from-CWD (`-local`)
# rundeps
, coreutils ? pkgs.coreutils
, libGL ? pkgs.libGL
, lua ? pkgs.lua54Packages.lua
, mono ? null
, nixGLChannel ? (pkgs.nixgl or import (fetchTarball "https://github.com/guibou/nixGL/archive/489d6b095ab9d289fe11af0219a9ff00fe87c7c5.tar.gz") {})
@ -90,7 +91,7 @@ in {
buildDotnetModule fetchpatch fetchzip hardLinkJoin launchScriptsFor makeDesktopItem
releaseTagSourceInfos runCommand symlinkJoin writeShellScriptBin
git
lua openal SDL2 udev zstd
libGL lua openal SDL2 udev zstd
buildConfig doCheck emuhawkBuildFlavour extraDefines extraDotnetBuildFlags;
mono = if mono != null
then mono # allow older Mono if set explicitly
@ -109,7 +110,10 @@ in {
inherit forNixOS;
hawkSourceInfo = hawkSourceInfoDevBuild;
};
asmsFromReleaseArtifacts = lib.mapAttrs (_: pp.splitReleaseArtifact) releaseArtifactInfos;
fillTargetOSDifferences = hawkSourceInfo: lib.optionalAttrs forNixOS { needsLibGLVND = true; } // hawkSourceInfo; # don't like this, but the alternative is including `forNixOS` in `hawkSourceInfo` directly
asmsFromReleaseArtifacts = lib.mapAttrs
(_: a: pp.splitReleaseArtifact (a // { hawkSourceInfo = fillTargetOSDifferences a.hawkSourceInfo; }))
releaseArtifactInfos;
# the asms for from-CWD and latest release from-source are exposed below as `bizhawkAssemblies` and `bizhawkAssemblies-latest`, respectively
# apart from that, no `asmsFromSource`, since if you're only after the assets you might as well use the release artifact
releasesEmuHawkInstallables = lib.pipe releaseFrags [
@ -137,13 +141,19 @@ in {
latestVersionFrag = lib.head releaseFrags;
combined = pp // asmsFromReleaseArtifacts // releasesEmuHawkInstallables // {
inherit depsForHistoricalRelease releaseTagSourceInfos;
bizhawkAssemblies = pp.buildAssembliesFor hawkSourceInfoDevBuild;
"bizhawkAssemblies-${latestVersionFrag}" = pp.buildAssembliesFor releaseTagSourceInfos."info-${latestVersionFrag}";
discohawk = pp.buildDiscoHawkInstallableFor { hawkSourceInfo = hawkSourceInfoDevBuild; };
bizhawkAssemblies = pp.buildAssembliesFor (fillTargetOSDifferences hawkSourceInfoDevBuild);
"bizhawkAssemblies-${latestVersionFrag}" = pp.buildAssembliesFor
(fillTargetOSDifferences releaseTagSourceInfos."info-${latestVersionFrag}");
discohawk = pp.buildDiscoHawkInstallableFor {
inherit forNixOS;
hawkSourceInfo = hawkSourceInfoDevBuild;
};
"discohawk-${latestVersionFrag}" = pp.buildDiscoHawkInstallableFor {
inherit forNixOS;
hawkSourceInfo = releaseTagSourceInfos."info-${latestVersionFrag}";
};
"discohawk-${latestVersionFrag}-bin" = pp.buildDiscoHawkInstallableFor {
inherit forNixOS;
bizhawkAssemblies = asmsFromReleaseArtifacts."bizhawkAssemblies-${latestVersionFrag}-bin";
};
emuhawk = emuhawk-local;