Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

steamvr: init #341095

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft

steamvr: init #341095

wants to merge 10 commits into from

Conversation

Pandapip1
Copy link
Contributor

Description of changes

I have been given permission to package SteamVR by a Valve employee.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 8.has: documentation This PR adds or changes documentation 6.topic: fetch labels Sep 10, 2024
@Pandapip1
Copy link
Contributor Author

CC @Scrumplex

@Scrumplex
Copy link
Member

This is jaw dropping. I never even considered packaging Steam apps like this xD

fileList ? [ ],
fileListRegex ? false,
debug ? false,
hash ? lib.fakeHash,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hash ? lib.fakeHash,
hash ? "",

This is more inline with fetchers like fetchCargoTarball and pnpm.fetchDeps

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the added complexity of doing it that way is particularly worth it. Those fetchers probably predate lib.fakeHash, so they chose the way that was simpler back then.

If you want to block on this, I'll change it, but I'd strongly prefer to keep it this way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the new comment. We can take advantage of the newly added lib.fetchers.withNormalizedHash to handle all of this logic for us (including the "" case)

}:

runCommand name
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{
({

Copy link
Contributor Author

@Pandapip1 Pandapip1 Sep 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this accomplish?

EDIT: Figured it out. See #341095 (comment)

Comment on lines 29 to 31
outputHash = hash;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it also doesn't force a sha256 hash

Suggested change
outputHash = hash;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
}
outputHash = hash;
outputHashMode = "recursive";
}
// lib.optionalAttrs (hash == "") { outputHashAlgo = "sha256"; })

pkgs/build-support/fetchsteam/default.nix Outdated Show resolved Hide resolved
pkgs/build-support/fetchsteam/default.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/readline/6.3.nix Outdated Show resolved Hide resolved
@NyCodeGHG
Copy link
Member

This looks pretty cool, but is there an advantage in using this over using SteamVR from the steam client?
(also fetchSteam in nixpkgs is nice)

@Scrumplex
Copy link
Member

This looks pretty cool, but is there an advantage in using this over using SteamVR from the steam client? (also fetchSteam in nixpkgs is nice)

SteamVR inside Steam's fhsenv suffers from #217119, which means you won't be able to use asynchronous reprojection without bad workarounds.

@NyCodeGHG
Copy link
Member

This looks pretty cool, but is there an advantage in using this over using SteamVR from the steam client? (also fetchSteam in nixpkgs is nice)

SteamVR inside Steam's fhsenv suffers from #217119, which means you won't be able to use asynchronous reprojection without bad workarounds.

Ah, i see. thank your for explaining :)

@Pandapip1
Copy link
Contributor Author

Additionally, this will allow other packages such as ALVR to depend on SteamVR.

Copy link
Member

@Atemu Atemu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite amazing. Thanks a bunch.

I see two things that must to be done here:

  1. We need a written record of Valve approving us to package SteamVR using patchelf. This doesn't need to be formal but some record we can point at to say "We're allowed to do this.". Precedent:
    /*
    License issues:
    Date: Mon, 10 Dec 2007 19:55:16 -0500
    From: TeamSpeak Sales <[email protected]>
    To: 'Marc Weber' <[email protected]>
    Subject: RE: teamspeak on nix?
    Yes, that would be fine. As long as you are not renting servers or selling
    TeamSpeak then you are more than welcome to distribute it.
    Thank you,
    TeamSpeak Sales Team
    ________________________________
    e-Mail: [email protected]
    TeamSpeak: http://www.TeamSpeak.com
    Account Login: https://sales.TritonCIA.com/users
    -----Original Message-----
    From: Marc Weber [mailto:[email protected]]
    Sent: Monday, December 10, 2007 5:03 PM
    To: [email protected]
    Subject: teamspeak on nix?
    Hello,
    nix is very young software distribution system (http://nix.cs.uu.nl/)
    I'd like to ask wether you permit us to add teamspeak (server/ client?)
    Sincerly
    Marc Weber (small nix contributor)
    */
  2. There needs to be documentation on the update procedure or, even better, an automatic updater.

@Pandapip1
Copy link
Contributor Author

Pandapip1 commented Sep 16, 2024

Well, here's the conversation, for now:


From: John, Gavin N. (Gavin) [email protected]
To: [email protected]
Subject: Permission to package SteamVR

Hi Valve VR folks,

I'm Gavin, an incoming freshman at Caltech. In my free time, I like to package programs for nixpkgs, the package repository for the nix package manager and its NixOS linux distribution.

I initially planned to package it by downloading it using depotdownloader, but discovered that SteamVR can't be downloaded in its entirety using anonymous accounts. This led me to discover the SteamVR licensing page, which had this email address.

Would you be okay with me modifying and distributing my copy of SteamVR for the purpose of making it available to install through nixpkgs? Nixpkgs has a mechanism to keep track of licenses that users have agreed to, so installation of SteamVR can require agreement to the Steam Subscriber Agreement, the Steam PC Café Agreement, and/or the SteamVR Commercial Installation License.

Thank you for your consideration!

Sincerely,

Gavin John


From: Ben Jackson [email protected]
Sent: Tuesday, September 10, 2024 10:38:22 AM
To: John, Gavin N. (Gavin) [email protected]
Subject: Re: Permission to package SteamVR

  • I initially planned to package it by downloading it using depotdownloader, but discovered that SteamVR can't be downloaded in its entirety using anonymous accounts.

Thanks for bringing this to our attention. I have fixed that issue.

  • Would you be okay with me modifying and distributing my copy of SteamVR for the purpose of making it available to install through nixpkgs?

We would rather avoid that. I assume if depotdownloader works again, this would no longer be preferably anyway.

--Ben


From: John, Gavin N. (Gavin) [email protected]
Sent: Tuesday, September 10, 2024 10:53 AM
To: Ben Jackson [email protected]
Subject: [External Mail] Re: Permission to package SteamVR

Hi Ben,

Thank you for your response! Thanks for fixing the issue with depot downloader. That's going to help a lot.

Some modifications to SteamVR will be necessary to make all functionality work with NixOS. Do I have permission to make a configuration file and script that makes the necessary modifications, and to have the config file and script distributed?

Thank you!

Sincerely,

Gavin


From: Ben Jackson [email protected]
To: "'John, Gavin N. (Gavin)'" [email protected]
Subject: RE: Permission to package SteamVR

It's fine to distribute patches that apply after downloading the base content.

If there are specific issues that you think are generic issues regarding portability you can also send them my way.

@Pandapip1
Copy link
Contributor Author

Pandapip1 commented Sep 16, 2024

I'm aware the packages I just added are missing some necessary things, such as formatting and meta. That's why this PR is a draft. For the time being, please refrain from leaving reviews on stuff that obviously needs changing.

Those packages will be necessary for the update script.

@Pandapip1 Pandapip1 force-pushed the init-steamvr branch 5 times, most recently from bea47b4 to ec926fd Compare September 16, 2024 21:17
@ofborg ofborg bot added 11.by: package-maintainer This PR was created by the maintainer of the package it changes and removed 10.rebuild-darwin: 1 labels Sep 17, 2024
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 1, 2024
@github-actions github-actions bot added the 6.topic: updaters Tooling for (semi-)automated updating of packages label Nov 10, 2024
@Pandapip1 Pandapip1 force-pushed the init-steamvr branch 2 times, most recently from 0f45302 to d343341 Compare November 10, 2024 06:06
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 10, 2024
@Pandapip1
Copy link
Contributor Author

According to SteamRE/DepotDownloader#566 (comment), there's an issue with our current version of depotdownloader. Therefore, this PR is kind of blocked on the dotnet SDK 9 packaging effort (I don't actually see a PR or open issue though?!)

@yuuko-partyvan
Copy link
Contributor

According to SteamRE/DepotDownloader#566 (comment), there's an issue with our current version of depotdownloader. Therefore, this PR is kind of blocked on the dotnet SDK 9 packaging effort (I don't actually see a PR or open issue though?!)

sorry, was misinformed on that last count; 2.7.4 is in the works! #359705

writeText,
}:

{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{
lib.makeOverridable (lib.fetchers.withNormalizedHash { } {

fileList ? [ ],
fileListRegex ? false,
debug ? false,
hash ? lib.fakeHash,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hash ? lib.fakeHash,
outputHash,
outputHashAlgo,

fileList ? [ ],
fileListRegex ? false,
debug ? false,
hash ? lib.fakeHash,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the new comment. We can take advantage of the newly added lib.fetchers.withNormalizedHash to handle all of this logic for us (including the "" case)


env.SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";

outputHash = hash;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
outputHash = hash;
inherit outputHash outputHashAlgo;

{
nativeBuildInputs = [ depotdownloader ];

env.SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
env.SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
env = {
DEPOT_DOWNLOADER_ARGS = toString (
[
"-app"
(toString app)
"-depot"
(toString depot)
"-manifest"
(toString manifest)
"-loginid"
# From DepotDownloader help:
# -loginid <#> - a unique 32-bit integer Steam LogonID in decimal, required if running multiple instances of DepotDownloader concurrently.
# We are running multiple instances of DepotDownloader concurrently, so this is required.
# Setting this to the manifest mod 2^32 will almost always result in a deterministic unique value.
# Nix doesn't have a builtin for mod, so we have to do it manually.
(toString (manifest - (manifest / 4294967295) * 4294967295)
]
++ lib.optionals (branch != null) [ "-beta" branch ]
++ lib.optionals (language != null) [ "-language" language ]
++ lib.optionals lowViolence [ "-lowviolence" ]
++ lib.optional (fileList != [ ]) (
lib.optionalString fileListRegex "regex:"
+ writeText "steam-file-list-${name}.txt" (lib.concatLines fileList)
)
++ lib.optional debug "-debug"
);
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
};

We can clean up the conditional flag logic a bit by using a proper Nix structure

stdenvNoCC.mkDerivation could also be used here to make this more overridable -- similar to other fetchers

hash = "sha256-aW4OsQi3N5yAMdbTd8rxbb2qYMfFJBR4WQFIXvxpiMw=";
};

build-system = [ setuptools ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
build-system = [ setuptools ];
nativeBuildInputs = [
setuptoolsBuildHook
pypaInstallHook
];

dependencies = [ gevent ];
nativeCheckInputs = [
coverage
pytestCheckHook
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pytestCheckHook
pytestCheckHook
pytest-cov-stub
coveralls

From dev_requirements.txt

buildPythonPackage rec {
pname = "steam";
version = "1.4.4";
pyproject = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pyproject = true;
pyproject = false;

./whydoesthisneedfixing.patch
];

build-system = [ setuptools ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
build-system = [ setuptools ];
nativeBuildInputs = [
setuptoolsBuildHook
pypaInstallHook
];

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should get a release note as well probably

@Pandapip1
Copy link
Contributor Author

Pandapip1 commented Nov 29, 2024

From https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/python.section.md:

pyproject: Whether the pyproject format should be used. As all other formats are deprecated, you are recommended to set this to true. When you do so, pypaBuildHook will be used, and you can add the required build dependencies from build-system.requires to build-system. Note that the pyproject format falls back to using setuptools, so you can use pyproject = true even if the package only has a setup.py. When set to false, you can use the existing hooks or provide your own logic to build the package. This can be useful for packages that don't support the pyproject format. When unset, the legacy setuptools hooks are used for backwards compatibility.

What's the rationale for pyproject = false?

@Pandapip1
Copy link
Contributor Author

With #359705 merged I'll start to address some of these review comments. For the time being, though, I will be keeping pyproject = true.

@getchoo
Copy link
Member

getchoo commented Dec 1, 2024

What's the rationale for pyproject = false?

I find it to be more technically correct and less likely to break in the future

...but the documentation is sorta vague with it saying "you can use pyproject = true even if the package only has a setup.py" rather than you should -- plus it mentions the method I'm suggesting here right after. So it can go either way, totally up to you :)

@Pandapip1
Copy link
Contributor Author

So it can go either way, totally up to you

If you don't mind, then I'll keep it pyproject = true.

@Pandapip1 Pandapip1 mentioned this pull request Dec 4, 2024
13 tasks
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: fetch 6.topic: python 6.topic: updaters Tooling for (semi-)automated updating of packages 8.has: documentation This PR adds or changes documentation 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants