Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
result
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
description = "phpggc - PHP Generic Gadget Chains";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
phpggc = pkgs.callPackage ./package.nix { };
in
{
packages = {
default = phpggc;
phpggc = phpggc;
};

apps.default = flake-utils.lib.mkApp { drv = phpggc; };

devShells.default = import ./shell.nix { inherit pkgs; };
});
}
39 changes: 39 additions & 0 deletions package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{ lib
, stdenvNoCC
, php
, makeWrapper
}:

stdenvNoCC.mkDerivation rec {
pname = "phpggc";
version = "0-unstable";

src = lib.cleanSource ./.;

nativeBuildInputs = [
makeWrapper
];

installPhase = ''
runHook preInstall

mkdir -p $out/share/phpggc
cp -R gadgetchains lib templates phpggc LICENSE README.md Dockerfile test-gc-compatibility.py $out/share/phpggc/
chmod 0644 $out/share/phpggc/phpggc

mkdir -p $out/bin
makeWrapper ${php}/bin/php $out/bin/phpggc \
--run "cd $out/share/phpggc" \
--add-flags "-d phar.readonly=0 $out/share/phpggc/phpggc"

runHook postInstall
'';

meta = with lib; {
description = "PHP Generic Gadget Chains";
homepage = "https://github.com/ambionics/phpggc";
license = licenses.asl20;
platforms = platforms.all;
mainProgram = "phpggc";
};
}
16 changes: 16 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{ pkgs ? import <nixpkgs> { } }:

let
phpggc = pkgs.callPackage ./package.nix { };
composer = pkgs.php.packages.composer;
in
pkgs.mkShell {
packages = [
phpggc
pkgs.php
composer
pkgs.curl
pkgs.python3
pkgs.python3Packages.rich
];
}