Skip to content

Commit 43725eb

Browse files
committed
Add flake package for the plugin zip
1 parent 3dbd046 commit 43725eb

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

flake.nix

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,25 @@
1111
with import nixpkgs { inherit system; };
1212
with pkgs;
1313
let
14+
name = "wp2static";
15+
version = "7.4.0";
16+
composerDeps = php.buildComposerProject (finalAttrs: {
17+
pname = "${name}-composer-deps";
18+
version = version;
19+
src = pkgs.lib.cleanSourceWith {
20+
src = self;
21+
filter = path: type:
22+
let rel = baseNameOf path;
23+
in rel == "composer.json" || rel == "composer.lock";
24+
};
25+
vendorHash = "sha256-lN/24P9LbuRuU/bc3DNPR0kZGtIhZfWcNqeL5puXj2w=";
26+
});
27+
wp2static = runCommand "wp2static" { } ''
28+
cp -r "${composerDeps}/share/php/${name}-composer-deps/vendor" $TMPDIR
29+
cp -r ${self}/src ${self}/views ${self}/*.php $TMPDIR
30+
mkdir -p $out
31+
${zip}/bin/zip -r -9 $out/wp2static.zip $TMPDIR
32+
'';
1433
phpVersions = {
1534
php81 = php81;
1635
php82 = php82;
@@ -21,7 +40,8 @@
2140
pkgs.writeShellScriptBin name ''${phpPkg}/bin/php "$@"'') phpVersions;
2241
in {
2342
devShells.default = mkShell {
24-
buildInputs = [ php phpPackages.composer shellcheck zip ] ++ phpBins;
43+
buildInputs = [ php phpPackages.composer shellcheck ] ++ phpBins;
2544
};
45+
packages = { inherit wp2static; };
2646
});
2747
}

0 commit comments

Comments
 (0)