!jngDrdMgndWibPCYsR:nixos.org

Nix PHP

67 Members
A room for PHP developers running on Nix19 Servers

Load older messages


SenderMessageTime
21 Nov 2023
@drupol:matrix.org@drupol:matrix.orgThis is a Nix killer feature :)08:33:10
@rikudou:lemmings.worldrikudou@lemmings.worldI've been planning to! I know the theory behind it, but haven't had time to learn the syntax, yet.08:33:53
@drupol:matrix.org@drupol:matrix.orgthe syntax is not that different from regular use of Nix08:34:07
@drupol:matrix.org@drupol:matrix.orgit's just that flake has a structure where multiple outputs can be created08:34:31
@drupol:matrix.org@drupol:matrix.org * it's just that flake has a fixed structure where multiple outputs can be created08:34:42
@rikudou:lemmings.worldrikudou@lemmings.worldWell, it's also very cryptic, I've read a bit on them and I still don't understand how to do even the most basic things. I still don't know how to incorporate the bits you shared today (about the php package) into, well, anything, be it configuration.nix or flake.nix.08:45:02
@rikudou:lemmings.worldrikudou@lemmings.worldIt seems like something I'll have to read on thoroughly and I don't have the time for that lately08:45:42
@drupol:matrix.org@drupol:matrix.orgOK, I can help if you want, just let me know clearly what is unclear and I'll do my best.08:47:31
@rikudou:lemmings.worldrikudou@lemmings.world Well, creating a complete shell.nix equivalent would be a great start, I have no clue how to install the package in a flake.nix 08:49:11
@drupol:matrix.org@drupol:matrix.org shell.nix was made to create development shells. This correspond to the attribute: devShells.default in a flake 08:49:53
@drupol:matrix.org@drupol:matrix.org * shell.nix was made to create development shells. This correspond to the attribute: devShells.default in a flake 08:50:29
@drupol:matrix.org@drupol:matrix.org For building stuff, it's packages.<something> 08:50:48
@rikudou:lemmings.worldrikudou@lemmings.world
In reply to @rikudou:lemmings.world

Here's a fully working shell.nix with what you want, it can easily be adapted to configuration.nix:

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
    nativeBuildInputs = with pkgs.buildPackages;
    let
      custom = import (builtins.fetchTarball https://github.com/nixos/nixpkgs/tarball/1d8b8365a02efbf668311dc9db06cb98d49e7302) {};
      php74 = custom.php74.buildEnv {
        extensions = ({ enabled, all }: enabled ++ (with all; [
          redis
          xdebug
        ]));
        extraConfig = ''
          xdebug.mode=debug
          date.timezone=Australia/Brisbane
        '';
      };
    in
    [
      php74
      custom.php74Packages.composer
      custom.php74Extensions.pdo
      custom.php74Extensions.redis
      custom.php74Extensions.xdebug
    ];
}
I meant more like adapting this to a flake.nix, if possible? That will probably help me find the connections
08:51:51
@drupol:matrix.org@drupol:matrix.orgOf course!09:00:23
@drupol:matrix.org@drupol:matrix.org Send me your shell.nix 09:00:31
@drupol:matrix.org@drupol:matrix.orgI'll do it quickly09:00:35
@rikudou:lemmings.worldrikudou@lemmings.worldDownload shell.nix09:00:58
@drupol:matrix.org@drupol:matrix.orgdoing it.09:02:15
@rikudou:lemmings.worldrikudou@lemmings.worldThanks!09:02:23
@drupol:matrix.org@drupol:matrix.orgWithout testing it, I'm pretty sure this should work: https://gist.github.com/drupol/8e5eb2f7cb344fe7009b72d97d1bd90f09:08:48
@drupol:matrix.org@drupol:matrix.orgimage.png
Download image.png
09:10:23
@drupol:matrix.org@drupol:matrix.orgYep, seems to work09:10:29
@drupol:matrix.org@drupol:matrix.orgNow, going to make it simpler.09:10:36
@rikudou:lemmings.worldrikudou@lemmings.world I get this error instead: error: getting status of '/nix/store/1wlb2g44ajwr6n14apkigayzqy227ylk-source/flake.nix': No such file or directory 09:11:02
@rikudou:lemmings.worldrikudou@lemmings.world Where does this come from on line 5? nixpkgs_php7429 09:12:53
@drupol:matrix.org@drupol:matrix.orgIt works here09:14:38
@drupol:matrix.org@drupol:matrix.orgMake sure you have the latest version of the file09:14:45
@drupol:matrix.org@drupol:matrix.org
In reply to @rikudou:lemmings.world
Where does this come from on line 5? nixpkgs_php7429
I made it up myself
09:14:56
@drupol:matrix.org@drupol:matrix.orgIt could be any name actually09:15:12
@drupol:matrix.org@drupol:matrix.org Once you are in the directory where the flake it, just do: nix develop 09:15:35

Show newer messages


Back to Room ListRoom Version: 6