-
Notifications
You must be signed in to change notification settings - Fork 626
Build nix packages from source #253
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
base: hovudstraum
Are you sure you want to change the base?
Conversation
@@ -73,25 +79,13 @@ let | |||
++ lib.optional withBasicAudioMetadata mutagen | |||
++ lib.optional withHashedPasswords argon2-cffi | |||
++ lib.optional withZeroMQ pyzmq | |||
++ (extraPythonPackages ps) | |||
); | |||
++ (extraPythonPackages python.packages); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I understand how this worked, so if someone could test it out I'll appreciate it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems correct. We don't strictly need it anymore, since it was only used in the partyfuse
package, but it's nice to have an escape hatch like this. Maybe @dtomvan can confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually that's still useful for using hooks with additional dependencies, so we keep it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python.packages
doesn't exist
I believe it's called python.pkgs
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, not sure where I got python.packages
from, sorry 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I was planning to use it for hooks which might require other arbitrary dependencies, like plyer
for notifications, but yes ps
was originally just the python package set when you do python3.withPackages
, so python.pkgs
is equivalent here.
Usage is like this: copyparty.override { extraPythonPackages = (ps: with ps; [ plyer matplotlib ]); }
Thanks for working on this. It has been bothering me since I realized that the release source isn't just a copy of the repo and does actually contain the built frontend dependencies (which was the final argument for using sfx.py for the package). We never got around to changing it due to it being in the process of merging into nixpkgs, putting into question the future of our version of the package (I still don't know what's the right move here, but I digress). Only a few things stand out to me:
|
Yeah, I was thinking about that too, I just got sidetracked and forgot to comment on it here. If we want to keep that feature I think we could pull the version from somewhere in the tarball (
Didn't notice, thanks for pointing that out! |
That would work. If you want to add it, that's great, but feel free to ignore it, since it's an unused feature anyway. Personally I'm leaning towards just removing it, to simplify the update script.
Sorry, I lied, it's |
Ok, did both. |
Okay, I've tried building and running it and we have some dependencies missing. They were a part of the I found a couple looking at
|
Ok, I'll add them in a bit. Btw, how did you find out that we're missing dependencies? Haven't done extensive testing yet since I'm not too familiar with copyparty yet, but it does seem to run just fine as is? |
These features are disabled by default but will hit import errors when enabled in the config. |
Ok, since they are optional should we lock them behind parameters like the other optional dependencies? Also partytftp isn't packaged in nixpkgs, so that'll have to be packaged separately |
Not surprising. That's @9001's fork of tftpy Feature flags would be nice, but maybe keep I've also noticed copyparty itself will provide details about optional dependencies when ran with
Somehow we have I'd expect a lot more items on this list. @9001 Is this check just outdated/incomplete? |
From my (little) time looking at partyftpy I think we can get away with overriding the
I'd say keep |
For |
Well, that makes it a whole lot easier, doesn't it? I initially was scared of migrating the package to a source build, because it looked like I needed to replicate the entire docker build process in nix. Luckily that's not the case. Thanks for this PR!
Well, I think they removed the Also, great news, this actually improves startup performance due to the python files being stored uncompressed! Bench: (the 2nd copyparty is from the nix package at
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after partytftp
gets added
mainProgram = "copyparty"; | ||
sourceProvenance = [ lib.sourceTypes.binaryBytecode ]; | ||
sourceProvenance = [ lib.sourceTypes.fromSource ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way this is implicitly the default when no sourceProvenance
was specified.
I didn't check github when I was adding That said, I'm not sure what you mean with not relying on the structure of |
As in, we don't want any potential changes to the |
Ok, I ran the current version and see no issues. I even deployed it on my big instance and nothing broke, with no changes necessary to my config. It's not a big sample size but it's better than nothing. |
Nah I don't want to change anything for now, I was thinking of trying to build the frontend deps but I don't want to deal with that rn. Maybe some other time.
Don't worry about it, y'all are pretty nice ^^ |
@9001 👀 |
"version": "1.18.7", | ||
"hash": "sha256-GRoiNnYRWNcq5ITywPv7bK4pdgTey6Or1cZqyE2XDf4=" | ||
"hash": "sha256-Zzj2I5BSduhmS9h5HxSX0MYfiBbGYI52xNkJehKEkXA=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New copyparty version released since then (again), so this will need to be bumped before (or after) merging.
You could wait until @9001 finds the time to review and merge it, to not play a catch-up game with every bugfix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This particular bugfix doesn't matter for the PR since we don't use the sfx anymore, but yeah, I'll wait for @9001 to review it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah the bugfix is for "older versions of python3", and well, nixpkgs always keeps their default python3
fairly recent, and get rid of EOL versions, so this is a non-issue to us.
Also, to make review easier, I think it's completely fine to squash some stuff upfront. Like 3 would be fine I think: (1) remove u2c and partyfuse, (2) build from source, (3) fixup dependencies. I think that makes it more straightforward for ed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, squashed.
Btw sorry for messing up the commit history, had a bit of a brain fart 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lol that's fine. Honestly I like the transparency it sometimes provides while one is responding to review suggestions. You can see the thought process. But yeah in most cases succinctness is more important IMO.
But enough bikeshedding 😅
c4a18ac
to
145d413
Compare
nix: remove u2c and partyfuse packages The main copyparty package has u2c and partyfuse, so these packages are redundant now nix: add fusepy dependency fix: nix: use replace pyfuse with fusepy
src = fetchurl { | ||
inherit (pinData) url hash; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just saying this is something that can be done, it's quite common for python packages in nixpkgs and I figured why not...
src = fetchurl { | |
inherit (pinData) url hash; | |
}; | |
src = fetchPypi { | |
inherit (pinData) pname version hash; | |
}; |
I think this also allows us to move away from the custom update script, because nix-update has special support for PyPi packages. That's for another PR I think though.
Then all the info would be contained in the derivation, like this:
# no pin.json anymore
buildPythonApplication rec {
pname = "copyparty";
version = "1.18.8";
src = fetchPyPi {
inherit pname version;
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
And the update script would then be a measly nix-update copyparty --flake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I do think it would be a good idea, if we were to do this @9001 would need to have nix installed to be able to update the nix packages (assuming that nix-update depends on nix), so we would need to know if he's ok with that.
If he is I'll be glad to do this in a separate PR tho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively (maybe digging the hole even further in the process lol) you could have a Github action with on: workflow_dispatch
that does the update with nix-update
I guess...
assuming that nix-update depends on nix
Yeah, it needs nix to evaluate stuff. That's about the only advantage of the home-grown py+json solution right now: it doesn't involve any nix files... but at the same time that's a decoupling that usually isn't really desirable
TBF the updater for openjdk in nixpkgs also does this...
Revert "nix: remove unused code from update.py" This reverts commit 48dfd73. nix: update local release pin function in update.py
Very new to this project and mostly just curious. Given this now builds from source and not build artifacts, what is the point of the pin, i.e. why isn't the source of the package just set roughly to Currently this approach results in counter-intuitive behavior: if you do |
You can set the source to ../../.. and copyparty itself will build, however that build would not include the web dependencies, so part of the UI would be missing/broken.
The build procedure for the web deps requires docker/podman, and as far as I know that can't run inside of a nix build, so we would need to figure out how to build them without docker, run docker inside of a VM (which nix does surprisingly support), or do what we do and take the source tarballs, which do include the web deps.
Aug 2, 2025, 1:17 AM by ***@***.***:
… justinas> left a comment > (9001/copyparty#253) <#253 (comment)>
Very new to this project and mostly just curious. Given this now builds from source and not build artifacts, what is the point of the pin, i.e. why isn't the source of the package just set roughly to > ../../..> ?
Currently this approach results in counter-intuitive behavior: if you do > nix run github:9001/copyparty> , i.e. try to run the latest commit (implicit), it runs the pinned stable release. What's more, if you attempt to "run" a specific version, i.e. > nix run github:9001/copyparty/v1.18.9> , it will build and run v1.18.8 instead (as that was the pin as of v1.18.9 release). Not to mention that > nix run> in a local checkout will not use local sources, and thus is unsuitable for development.
—
Reply to this email directly, > view it on GitHub <#253 (comment)>> , or > unsubscribe <https://github.com/notifications/unsubscribe-auth/AJJUMAS55FK3R3OFNBCG75T3LPYOXAVCNFSM6AAAAACCSO6W5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCNBVHE4TCNJTGQ>> .
You are receiving this because you authored the thread.> Message ID: > <9001/copyparty/pull/253/c3145991534> @> github> .> com>
|
Thanks, I see. I missed the fact that this still builds from somewhat "pre-processed" source code, not the literal contents of the repo. I understand why that is, as the build process for the frontend assets seems complex and quite ad-hoc. |
Removed the
u2c
andpartyfuse
packages since the maincopyparty
package has them now.This PR complies with the DCO; https://developercertificate.org/