php: simple builder add devShell

This commit is contained in:
Martin Toman 2022-09-09 13:40:01 -07:00
parent eec7febc8d
commit 44d95b3adc
2 changed files with 41 additions and 1 deletions

View File

@ -44,6 +44,13 @@
(name: version: {"${version}" = makePackage name version;})
args.packages
);
devShells =
{default = devShells.${defaultPackageName};}
// (
l.mapAttrs
(name: version: packages.${name}.${version}.devShell)
args.packages
);
# Generates a derivation for a specific package name + version
makePackage = name: version: let
@ -135,11 +142,20 @@
done
fi
'';
passthru.devShell = import ./devShell.nix {
inherit
name
pkg
;
inherit (pkgs) mkShell;
php = pkgs.php81;
};
};
in
# apply packageOverrides to current derivation
produceDerivation name pkg;
in {
inherit packages;
inherit packages devShells;
};
}

View File

@ -0,0 +1,24 @@
{
name,
pkg,
mkShell,
php,
}:
mkShell {
buildInputs = [
php
];
shellHook = let
vendorDir =
pkg.overrideAttrs (old: {
dontInstall = true;
})
+ "/lib/vendor/${name}/vendor";
in ''
rm -rf ./vendor
mkdir vendor
cp -r ${vendorDir}/* vendor/
chmod -R +w ./vendor
export PATH="$PATH:$(realpath ./vendor)/bin"
'';
}