xref: /plugin/combo/shell.nix (revision 81f56eb90da55cece29ce129c7b54b0ac748dc2d)
1*81f56eb9SNicolas GERARD# Need to get the mkShellNoCC function
2*81f56eb9SNicolas GERARDlet
3*81f56eb9SNicolas GERARD  nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.11";
4*81f56eb9SNicolas GERARD  # config and overlays are set to avoid them to being overridden by global configuration.
5*81f56eb9SNicolas GERARD  pkgs = import nixpkgs { config = {}; overlays = []; };
6*81f56eb9SNicolas GERARDin
7*81f56eb9SNicolas GERARD
8*81f56eb9SNicolas GERARD# Needed to get the php 7.4.29 version (does not have mkShellNoCC)
9*81f56eb9SNicolas GERARD# 7.4.32 was not available
10*81f56eb9SNicolas GERARD# https://lazamar.co.uk/nix-versions/?package=php-with-extensions&version=7.4.29&fullName=php-with-extensions-7.4.29&keyName=php74&revision=6e3a86f2f73a466656a401302d3ece26fba401d9&channel=nixpkgs-unstable#instructions
11*81f56eb9SNicolas GERARDlet
12*81f56eb9SNicolas GERARD  nixpkgsWithPhp74 = fetchTarball "https://github.com/NixOS/nixpkgs/archive/6e3a86f2f73a466656a401302d3ece26fba401d9.tar.gz";
13*81f56eb9SNicolas GERARD  pkgsWithPhp74 = import nixpkgsWithPhp74 { config = {}; overlays = []; };
14*81f56eb9SNicolas GERARD  php74 = pkgsWithPhp74.php74.buildEnv {
15*81f56eb9SNicolas GERARD      extensions = { enabled, all }: enabled ++ (with all; [ opcache ]);
16*81f56eb9SNicolas GERARD  };
17*81f56eb9SNicolas GERARDin
18*81f56eb9SNicolas GERARD
19*81f56eb9SNicolas GERARD# mkShellNoCC: a shell but without a compiler toolchain.
20*81f56eb9SNicolas GERARD# https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-mkShell
21*81f56eb9SNicolas GERARDpkgs.mkShellNoCC {
22*81f56eb9SNicolas GERARD  packages = [
23*81f56eb9SNicolas GERARD    # Php package
24*81f56eb9SNicolas GERARD    # https://nixos.org/manual/nixpkgs/stable/#sec-php
25*81f56eb9SNicolas GERARD    # https://wiki.nixos.org/wiki/PHP
26*81f56eb9SNicolas GERARD    php74
27*81f56eb9SNicolas GERARD  ];
28*81f56eb9SNicolas GERARD  # ShellHook: run some commands before entering the shell environment
29*81f56eb9SNicolas GERARD  shellHook = ''
30*81f56eb9SNicolas GERARD    echo "PHP version: $(php --version | head -n 1)"
31*81f56eb9SNicolas GERARD    '';
32*81f56eb9SNicolas GERARD}