1
0
forked from Public/pics

Add Nix flake for dev environment

Provides PHP with imagick, pdo_mysql, pdo_sqlite extensions, composer,
and sqlite CLI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 12:14:09 +01:00
parent 5832ce6228
commit a4d453792d
2 changed files with 74 additions and 0 deletions

47
flake.nix Normal file
View File

@@ -0,0 +1,47 @@
{
description = "HashRU Pics dev environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { self, nixpkgs }:
let
forAllSystems = f: nixpkgs.lib.genAttrs [
"x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"
] (system: f nixpkgs.legacyPackages.${system});
php = pkgs: pkgs.php.buildEnv {
extensions = { enabled, all }: enabled ++ (with all; [
imagick
pdo_mysql
pdo_sqlite
]);
extraConfig = ''
memory_limit = 256M
upload_max_filesize = 50M
post_max_size = 50M
'';
};
in
{
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
buildInputs = [
(php pkgs)
(php pkgs).packages.composer
pkgs.sqlite
];
shellHook = ''
export COMPOSER_HOME="$PWD/.composer"
if [ ! -d vendor ]; then
echo "Running composer install..."
composer install
fi
'';
};
});
};
}