nixpkgs/pkgs/by-name/pr/proton-ge-bin/package.nix
Atemu 74c55dbb25 proton-ge-bin: make $out provide an error when added to an env
This package should never be added to systemPackages or other global
environments as it will not provide any function there. Making its $out a file
will prevent buildEnv from including it; providing an error like this:

error: The store path /nix/store/wxl3m27dmjjsfqvzzxw7ibr0gr54wwkp-proton-ge-bin-GE-Proton9-1 is a file and can't be merged into an environment using pkgs.buildEnv! at /nix/store/ndhb3bsaf3zc6gx22vjl0w11sxvapf7b-builder.pl line 122.

Some breadcrumbs are left inside the file.
2024-03-16 17:59:27 +01:00

58 lines
2.2 KiB
Nix

{ lib
, stdenvNoCC
, fetchzip
, writeScript
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "proton-ge-bin";
version = "GE-Proton9-1";
src = fetchzip {
url = "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/${finalAttrs.version}/${finalAttrs.version}.tar.gz";
hash = "sha256-odpzRlzW7MJGRcorRNo784Rh97ssViO70/1azHRggf0=";
};
outputs = [ "out" "steamcompattool" ];
buildCommand = ''
runHook preBuild
# Make it impossible to add to an environment. You should use the appropriate NixOS option.
# Also leave some breadcrumbs in the file.
echo "${finalAttrs.pname} should not be installed into environments. Please use programs.steam.extraCompatPackages instead." > $out
ln -s $src $steamcompattool
runHook postBuild
'';
/*
We use the created releases, and not the tags, for the update script as nix-update loads releases.atom
that contains both. Sometimes upstream pushes the tags but the Github releases don't get created due to
CI errors. Last time this happened was on 8-33, where a tag was created but no releases were created.
As of 2024-03-13, there have been no announcements indicating that the CI has been fixed, and thus
we avoid nix-update-script and use our own update script instead.
See: <https://github.com/NixOS/nixpkgs/pull/294532#issuecomment-1987359650>
*/
passthru.updateScript = writeScript "update-proton-ge" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts
repo="https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases"
version="$(curl -sL "$repo" | jq 'map(select(.prerelease == false)) | .[0].tag_name' --raw-output)"
update-source-version proton-ge-bin "$version"
'';
meta = {
description = ''
Compatibility tool for Steam Play based on Wine and additional components.
(This is intended for use in the `programs.steam.extraCompatPackages` option only.)
'';
homepage = "https://github.com/GloriousEggroll/proton-ge-custom";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ NotAShelf shawn8901 ];
platforms = [ "x86_64-linux" ];
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
};
})