-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathshell.nix
32 lines (30 loc) · 1.31 KB
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Need to get the mkShellNoCC function
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.11";
# config and overlays are set to avoid them to being overridden by global configuration.
pkgs = import nixpkgs { config = {}; overlays = []; };
in
# Needed to get the php 7.4.29 version (does not have mkShellNoCC)
# 7.4.32 was not available
# 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
let
nixpkgsWithPhp74 = fetchTarball "https://github.com/NixOS/nixpkgs/archive/6e3a86f2f73a466656a401302d3ece26fba401d9.tar.gz";
pkgsWithPhp74 = import nixpkgsWithPhp74 { config = {}; overlays = []; };
php74 = pkgsWithPhp74.php74.buildEnv {
extensions = { enabled, all }: enabled ++ (with all; [ opcache ]);
};
in
# mkShellNoCC: a shell but without a compiler toolchain.
# https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-mkShell
pkgs.mkShellNoCC {
packages = [
# Php package
# https://nixos.org/manual/nixpkgs/stable/#sec-php
# https://wiki.nixos.org/wiki/PHP
php74
];
# ShellHook: run some commands before entering the shell environment
shellHook = ''
echo "PHP version: $(php --version | head -n 1)"
'';
}