Nix PHP | 74 Members | |
| A room for PHP developers running on Nix | 21 Servers |
| Sender | Message | Time |
|---|---|---|
| 12 Mar 2022 | ||
| Good night! | 22:56:37 | |
So, using php80Extensions.xdebug doesn't automatically add Xdebug to the php.ini file. How would I configure that in default.nix? | 23:01:44 | |
| I honestly have no idea what I'm doing 😆 | 23:13:55 | |
| this hasn't really helped me get set up: https://nixos.org/manual/nixpkgs/stable/#sec-php | 23:14:49 | |
| 'cause clearly this is wrong:
| 23:15:35 | |
(my default.nix) | 23:15:49 | |
In reply to @ramsey:matrix.orgthat should work (though you will also want to keep the enabled) | 23:34:23 | |
it tells me that it doesn't recognize php as a variable name | 23:34:57 | |
oh, right, you need to use pkgs.php | 23:35:20 | |
| In Nix, like in most programming languages, only variables that are explicitly introduced into scope are available to use | 23:36:06 | |
I don't know how to include pkgs.php | 23:36:28 | |
it should be available inside the function body (since the function takes pkgs as an argument) | 23:37:12 | |
* pkgs should be available inside the function body (since the function takes pkgs as an argument) | 23:37:21 | |
| this tutorial doesn't give me any indication of how to include packages: https://nixos.org/guides/dev-environment.html | 23:37:26 | |
and reading about it here doesn't show me how to add it to my default.nix file: https://search.nixos.org/packages?channel=21.11&show=php&from=0&size=50&sort=relevance&type=packages&query=php | 23:38:00 | |
| you can do something like:
| 23:39:09 | |
| how am I supposed to know that? Is that in a tutorial that I'm missing? | 23:39:44 | |
the guide relies on the fact that when default.nix contains a function, nix-shell and nix-build will automatically call it (and since you do not pass the pkgs argument, the default value after the question mark will be used) | 23:40:39 | |
| many of these guides are too “monkey see, monkey do” but unfortunately, the other alternative is learning Nix syntax and semantics first and then the same for Nixpkgs, which is a very long road | 23:43:50 | |
| * many of these guides are too “monkey see, monkey do” for my taste. But unfortunately, the other alternative is learning Nix syntax and semantics first and then the same for Nixpkgs, which is a very long road | 23:44:56 | |
| Right. Unfortunately, for me this monkey needs to see more so that I can do more 😉 | 23:45:16 | |
| I would recommend getting intimately familiar with the syntax section of Nix manual https://nixos.org/manual/nix/stable/expressions/writing-nix-expressions.html | 23:46:26 | |
| and then either ask about the stuff that is unclear in the guides, or assume it is not important for the task if it is not explained | 23:48:03 | |
| k | 23:48:19 | |
In reply to @ramsey:matrix.orgbuilding from source is not just about portability (which is indeed less of an issue with text-based languages like PHP), the primary concern is that the PHAR is opaque, so it is hard to solve issues with it (e.g. apply patches) | 23:52:24 | |
| good point... it can also be environment-specific | 23:53:06 | |
| i.e., include the wrong versions of packages for the environment you're on | 23:53:26 | |
| then there is also a security aspect – this is not critical for us, since we do not have the resources to verify each source at the moment, but that would be another argument for Debian or Fedora | 23:54:36 | |
| but NixOS is still quite pragmatic, so if not using PHAR from upstream is too much work, we will use it | 23:56:34 | |
| * but NixOS is still quite pragmatic, so if not using PHAR from upstream is too much work, we will use it (in fact, we do that for most PHP tools) | 23:57:00 | |