Skip to content

Commit

Permalink
Filter the sources of development projects
Browse files Browse the repository at this point in the history
  • Loading branch information
svanderburg committed Mar 1, 2022
1 parent c1f98cd commit 299caca
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion php-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ in
composerEnv.buildPackage {
inherit packages devPackages noDev;
name = "svanderburg-composer2nix";
src = ./.;
src = composerEnv.filterSrc ./.;
executable = true;
symlinkDependencies = false;
meta = {
Expand Down
2 changes: 1 addition & 1 deletion src/Composer2Nix/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function toNixAST()
{
return new NixFunInvocation(new NixExpression("composerEnv.buildPackage"), array(
"name" => $this->composerConfig->packageName,
"src" => new NixFile("./."),
"src" => new NixFunInvocation(new NixExpression("composerEnv.filterSrc"), new NixFile("./.")),
"executable" => $this->executable,
"packages" => new NixInherit(),
"devPackages" => new NixInherit(),
Expand Down
5 changes: 5 additions & 0 deletions src/Composer2Nix/composer-env.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

let
inherit (phpPackages) composer;

filterSrc = src:
builtins.filterSource (path: type: type != "directory" || (baseNameOf path != ".git" && baseNameOf path != ".git" && baseNameOf path != ".svn")) src;

buildZipPackage = { name, src }:
stdenv.mkDerivation {
inherit name src;
Expand Down Expand Up @@ -233,6 +237,7 @@ let
} // extraArgs);
in
{
inherit filterSrc;
composer = lib.makeOverridable composer;
buildZipPackage = lib.makeOverridable buildZipPackage;
buildPackage = lib.makeOverridable buildPackage;
Expand Down
2 changes: 1 addition & 1 deletion tests/dependencies/php-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ in
composerEnv.buildPackage {
inherit packages devPackages noDev;
name = "dependencies";
src = ./.;
src = composerEnv.filterSrc ./.;
executable = false;
symlinkDependencies = false;
meta = {};
Expand Down
2 changes: 1 addition & 1 deletion tests/enduser/php-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ in
composerEnv.buildPackage {
inherit packages devPackages noDev;
name = "phpunit-phpunit";
src = ./.;
src = composerEnv.filterSrc ./.;
executable = true;
symlinkDependencies = false;
meta = {};
Expand Down

0 comments on commit 299caca

Please sign in to comment.