php: granular builder add devShells

This commit is contained in:
Martin Toman 2022-09-17 14:05:44 -07:00
parent c07df07605
commit 20153fa376
2 changed files with 41 additions and 1 deletions

View File

@ -70,6 +70,13 @@
})
args.packages
);
devShells =
{default = devShells.${defaultPackageName};}
// (
l.mapAttrs
(name: version: packages.${name}.${version}.devShell)
args.packages
);
# manage packages in attrset to prevent duplicated evaluation
allPackages =
@ -200,11 +207,20 @@
popd
'';
passthru.devShell = import ./devShell.nix {
inherit
name
pkg
php
;
inherit (pkgs) mkShell;
};
};
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 (_: {
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"
'';
}