diff --git a/box.json.dist b/box.json.dist index 99d341c..15273ac 100644 --- a/box.json.dist +++ b/box.json.dist @@ -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, diff --git a/flake.lock b/flake.lock index f1371b0..d824f37 100644 --- a/flake.lock +++ b/flake.lock @@ -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" } diff --git a/flake.nix b/flake.nix index e3c6e60..f0e0e11 100644 --- a/flake.nix +++ b/flake.nix @@ -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 + ''; }; }; } diff --git a/run b/run new file mode 100755 index 0000000..3aad137 --- /dev/null +++ b/run @@ -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 [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}"