!jngDrdMgndWibPCYsR:nixos.org

Nix PHP

73 Members
A room for PHP developers running on Nix21 Servers

Load older messages


SenderMessageTime
12 Mar 2022
@drupol:matrix.orgPol
In reply to @ramsey:matrix.org
I'm trying to set up a development environment with nix pkgs, and Phive is one of the tools I need in that environment 🙂
You might want to have a look at what I use everyday: https://GitHub.com/loophp/nix-shell
22:39:26
@drupol:matrix.orgPol
In reply to @ramsey:matrix.org
Oh. You mean the Nix PHP maintainers?
Yes :)
22:39:37
@ramsey:matrix.orgramseyI thought you meant the PHP internals developers 🤣22:39:54
@drupol:matrix.orgPolSorry about the confusion22:40:04
@ramsey:matrix.orgramsey No worries 22:40:44
@drupol:matrix.orgPolGoing to turn off the lights here, I'll continue tomorrow 22:42:11
@drupol:matrix.orgPolIt's midnight, I need some sleep22:42:25
@ramsey:matrix.orgramseyGood night!22:56:37
@ramsey:matrix.orgramsey 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
@ramsey:matrix.orgramseyI honestly have no idea what I'm doing 😆23:13:55
@ramsey:matrix.orgramseythis hasn't really helped me get set up: https://nixos.org/manual/nixpkgs/stable/#sec-php23:14:49
@ramsey:matrix.orgramsey

'cause clearly this is wrong:

{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/bacbfd713b4781a4a82c1f390f8fe21ae3b8b95b.tar.gz") {} }:

php.buildEnv {
    extensions = { all, ... }: with all; [ xdebug ];
}
23:15:35
@ramsey:matrix.orgramsey (my default.nix) 23:15:49
@jtojnar:matrix.orgJan Tojnar
In reply to @ramsey:matrix.org

'cause clearly this is wrong:

{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/bacbfd713b4781a4a82c1f390f8fe21ae3b8b95b.tar.gz") {} }:

php.buildEnv {
    extensions = { all, ... }: with all; [ xdebug ];
}
that should work (though you will also want to keep the enabled)
23:34:23
@ramsey:matrix.orgramsey it tells me that it doesn't recognize php as a variable name 23:34:57
@jtojnar:matrix.orgJan Tojnar oh, right, you need to use pkgs.php 23:35:20
@jtojnar:matrix.orgJan TojnarIn Nix, like in most programming languages, only variables that are explicitly introduced into scope are available to use23:36:06
@ramsey:matrix.orgramsey I don't know how to include pkgs.php 23:36:28
@jtojnar:matrix.orgJan Tojnar it should be available inside the function body (since the function takes pkgs as an argument) 23:37:12
@jtojnar:matrix.orgJan Tojnar * pkgs should be available inside the function body (since the function takes pkgs as an argument) 23:37:21
@ramsey:matrix.orgramseythis tutorial doesn't give me any indication of how to include packages: https://nixos.org/guides/dev-environment.html23:37:26
@ramsey:matrix.orgramsey 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
@jtojnar:matrix.orgJan Tojnar

you can do something like:

let
  pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/bacbfd713b4781a4a82c1f390f8fe21ae3b8b95b.tar.gz") {};
in
pkgs.php.buildEnv {
    extensions = { all, enabled ... }: enabled ++ (with all; [ xdebug ]);
}
23:39:09
@ramsey:matrix.orgramseyhow am I supposed to know that? Is that in a tutorial that I'm missing?23:39:44
@jtojnar:matrix.orgJan Tojnar 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
@jtojnar:matrix.orgJan Tojnarmany 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 road23:43:50
@jtojnar:matrix.orgJan Tojnar * 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 road23:44:56
@ramsey:matrix.orgramseyRight. Unfortunately, for me this monkey needs to see more so that I can do more 😉23:45:16
@jtojnar:matrix.orgJan TojnarI would recommend getting intimately familiar with the syntax section of Nix manual https://nixos.org/manual/nix/stable/expressions/writing-nix-expressions.html23:46:26
@jtojnar:matrix.orgJan Tojnarand 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 explained23:48:03

Show newer messages


Back to Room ListRoom Version: 6