Nix PHP | 76 Members | |
| A room for PHP developers running on Nix | 22 Servers |
| Sender | Message | Time |
|---|---|---|
| 29 Mar 2023 | ||
| * Hey PHPers, Do you think we can do something similar but for PHP ? This is the file handling the import of the | 07:23:31 | |
| https://github.com/NixOS/nixpkgs/blob/nixos-22.11/pkgs/tools/networking/rustcat/default.nix This is an example of usage of this, right? What I really don't like about this method is that it completely hides all dependencies from the rest of the system. | 07:32:25 | |
| AFAIU Pol was specifically talking about the approach where you import the Cargo.lock rather than using a FOD and this method doesn't have this flaw, correct? | 07:35:28 | |
| Oh, that would be cool. | 07:35:51 | |
| Is there an example of it's usage in nixpkgs somewhere? | 07:37:59 | |
| Regarding the original question: without having taken a close look I think that this should be possible and I'd really like it (especially because I could get rid of at least one occurrence of composer2nix in my employer's deployment I guess). | 07:38:43 | |
| in other words, congrats you got the job :P | 07:38:50 | |
| Yeah, if it works like that, I'd delighted to have it. | 07:40:00 | |
| I do not think it's possible, we do not always have the shasum in the composer lockfile | 07:43:34 | |
In reply to @tgerbet:matrix.orgDoesn't each dependency in the lockfile have a source field with a content hash? But I may be missing your point :) | 07:44:41 | |
I remember correctly no, Composer does not set shasum for "Git" packages (even if it uses the GitHub API to download the package...) | 07:52:56 | |
* If I remember correctly no, Composer does not set shasum for "Git" packages (even if it uses the GitHub API to download the package...) | 07:53:02 | |
| Seems so, at least from the lock files I just checked. | 07:53:46 | |
| But builtins.fetchgit also doesn't require a shasum, right? | 07:54:54 | |
that won't be doable in nixpkgs then, tl;dr for why we use e.g. pkgs.fetchgit rather than builtins.fetchgit: https://discourse.nixos.org/t/replace-nixpkgs-fetchers-with-nix-builtins-fetchers/26106 | 08:14:37 | |
In reply to @tgerbet:matrix.orgoof, I looked at the wrong key, namely content and not shasum... good morning ma27 (and sorry for the confusion!) 🙃 | 08:15:52 | |
| unless we manage to sneak this into composer somehow I doubt that it'll be feasible (as it is with Rust for instance) | 08:18:13 | |
| 08:34:02 | ||
| Catching up the backlog, got in a meeting. Reading your messages. | 08:37:31 | |
In reply to @philipp:xndr.dehere? https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/typesetting/typst/default.nix | 08:38:56 | |
In reply to @tgerbet:matrix.orgWe can ask Jordi to add it :) | 08:39:18 | |
Hum yes but it would take a while to propagate to the whole ecosystem and it is likely on purpose. You do not get the same content if you --prefer-dist or --prefer-source | 08:41:28 | |
| Ah ?! | 08:42:23 | |
Oh, it's even documented! https://nixos.org/manual/nixpkgs/stable/#rust They seem to have the same problem with git hashes and solve it by providing them in the call tho cargoLock. | 08:42:53 | |
Therefore, buildRustPackage also supports vendoring dependencies directly from a Cargo.lock file using the cargoLock argument. This will retrieve the dependencies using fixed-output derivations from the specified lockfile. | 08:45:02 | |
| We should do that for PHP :) | 08:45:10 | |
* Oh, it's even documented! https://nixos.org/manual/nixpkgs/stable/#rust They seem to have the same problem with git hashes and solve it by providing them in the call to cargoLock. | 08:48:40 | |
In reply to @drupol:matrix.orgYes, when using prefer-dist Composer will try to get the tarball directly from GH/GL/whatever which will use the export-ignorethat the dep might have set in .gitattributes. When using prefer-source it will do a git clone directly | 08:50:17 | |
In reply to @tgerbet:matrix.orgWe could imagine to have rules. If we want to have Nix to build a PHP library or app, the composer.json must have been built using --prefer-source (or whatever). Since this lock file must be in Nix, it's fine. | 08:51:42 | |
See here, the Cargo.lock is inside nixpkgs: https://github.com/NixOS/nixpkgs/tree/master/pkgs/tools/typesetting/typst | 08:52:18 | |