build: generate a phar version of build-configs

This commit is contained in:
Oliver Davies 2023-10-06 23:35:55 +01:00
parent ae6155dc39
commit 3a86b4813a
4 changed files with 72 additions and 24 deletions

View file

@ -1,14 +1,29 @@
{
"output": "build-configs",
"files-bin": [
".env.local.php",
"files": [
".env",
"autoload_runtime.template",
"src/Controller/.gitignore"
"src/Controller/.gitignore",
"templates/fractal/.dockerignore.twig",
"templates/fractal/.env.example.twig",
"templates/fractal/.envrc.twig",
"templates/fractal/.yarnrc.twig",
"templates/fractal/.hadolint.yaml.twig",
"templates/fractal/.gitignore.twig",
"templates/drupal/.dockerignore.twig",
"templates/drupal/.env.example.twig",
"templates/drupal/.hadolint.yaml.twig",
"templates/drupal/.gitignore.twig",
"templates/terraform/.gitignore.twig",
"templates/astro/.envrc.twig",
"templates/astro/.gitignore.twig"
],
"directories": [
"config",
"public",
"resources",
"templates",
"templates/common/.githooks",
"templates/drupal/.github",
"var"
],
"force-autodiscovery": true,

View file

@ -19,16 +19,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1687412861,
"narHash": "sha256-Z/g0wbL68C+mSGerYS2quv9FXQ1RRP082cAC0Bh4vcs=",
"lastModified": 1696374741,
"narHash": "sha256-gt8B3G0ryizT9HSB4cCO8QoxdbsHnrQH+/BdKxOwqF0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e603dc5f061ca1d8a19b3ede6a8cf9c9fcba6cdc",
"rev": "8a4c17493e5c39769f79117937c79e1c88de6729",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}

View file

@ -10,22 +10,10 @@
buildInputs = with pkgs; [ php82 php82Packages.composer ];
};
packages.default = pkgs.stdenv.mkDerivation {
name = "build-configs2";
src = ".";
# buildPhase = ''
# echo "build"
# ls
# '';
installPhase = ''
touch $out
# mkdir $out
# cp bin vendor $out
# ls "$out"
'';
};
packages.default = pkgs.runCommand "default" { src = "./."; } ''
mkdir -p $out
cp ./build-configs $out
'';
};
};
}

45
run Executable file
View file

@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -eu
TTY="${TTY:-}"
if [[ ! -t 1 ]]; then
TTY="-T"
fi
export PATH=$PATH:./bin:./vendor/bin:./vendor-bin/box/vendor/bin
# Delete any temporary or generated files.
function clean {
rm -frv build build-configs tmp vendor vendor-bin/box/vendor
}
# Build the phar version of build-configs.
function build {
clean
# Install dependencies.
composer validate
composer install --no-dev --prefer-dist --optimize-autoloader
composer install --prefer-dist --optimize-autoloader --working-dir ./vendor-bin/box
# Rebuild the Symfony cache.
build-configs cache:clear
# Generate the phar file.
box compile --config box.json.dist
# TODO: build a Nix derivation and add it to the store.
}
# Display a list of all available commands.
function help {
printf "%s <task> [args]\n\nTasks:\n" "${0}"
compgen -A function | grep -v "^_" | cat -n
printf "\nExtended help:\n Each task has comments for general usage\n"
}
TIMEFORMAT=$'\nTask completed in %3lR'
time "${@:-help}"