diff --git a/sculpin/.bcignore b/sculpin/.bcignore new file mode 100644 index 000000000..6c7b69a01 --- /dev/null +++ b/sculpin/.bcignore @@ -0,0 +1 @@ +.gitignore diff --git a/sculpin/build b/sculpin/build index 2163f52ee..6e7ad3a12 100755 --- a/sculpin/build +++ b/sculpin/build @@ -1,5 +1,9 @@ #!/usr/bin/env bash -set -uexo pipefail +set -euo pipefail -vendor/bin/sculpin generate --watch --server "$@" +export PATH="$PATH:./vendor/bin" + +: "${APP_ENV:=prod}" + +sculpin generate --env "$APP_ENV" "$@" diff --git a/sculpin/build-configs.yaml b/sculpin/build-configs.yaml new file mode 100644 index 000000000..159eb5a52 --- /dev/null +++ b/sculpin/build-configs.yaml @@ -0,0 +1,3 @@ +--- +name: oliverdavies.uk +template: php-sculpin diff --git a/sculpin/clean b/sculpin/clean new file mode 100755 index 000000000..b312cf3d9 --- /dev/null +++ b/sculpin/clean @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -euo pipefail + +rm -rfv output_* vendor diff --git a/sculpin/flake-modules/dev-shell.nix b/sculpin/flake-modules/dev-shell.nix deleted file mode 100644 index 19b1cb76e..000000000 --- a/sculpin/flake-modules/dev-shell.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ inputs, ... }: - -{ - imports = [ inputs.devshell.flakeModule ]; - - perSystem = - { pkgs, self', ... }: - { - devshells.default = { - packages = with pkgs; [ - nodePackages.browser-sync - - (php83.buildEnv { - extraConfig = '' - error_reporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED - ''; - }) - - php83Packages.composer - - self'.packages.drafts - self'.packages.new-draft - self'.packages.publish - - tailwindcss - ]; - }; - }; -} diff --git a/sculpin/flake-modules/drafts.nix b/sculpin/flake-modules/drafts.nix deleted file mode 100644 index f1ac84955..000000000 --- a/sculpin/flake-modules/drafts.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - perSystem = - { pkgs, ... }: - { - packages.drafts = pkgs.writeShellApplication { - name = "drafts"; - - runtimeInputs = with pkgs; [ gnugrep ]; - - text = '' - echo "oob" - grep -r 'draft: true' "''${1:-source}" - ''; - }; - }; -} diff --git a/sculpin/flake-modules/new-draft.nix b/sculpin/flake-modules/new-draft.nix deleted file mode 100644 index 31ee75800..000000000 --- a/sculpin/flake-modules/new-draft.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - perSystem = - { pkgs, ... }: - { - packages.new-draft = pkgs.writeShellApplication { - name = "new-draft"; - - runtimeInputs = with pkgs; [ - coreutils - git - ]; - - text = '' - title="$1" - - exclude_words="for|at|and" - - filtered_title=$(echo "$title" | sed -E "s/\b($exclude_words)\b//g") - - slug=$(echo "$filtered_title" | tr '[:upper:]' '[:lower:]' | sed -e 's/[^a-z0-9]/-/g' -e 's/-\+/-/g' -e 's/^-//g' -e 's/-$//g') - - file="source/_posts/$slug.md" - - echo -e "---\ntitle: $title\ndate: ~\ndraft: true\n---" > "$file" - - echo "File created: $file" - - git add "$file" - git commit -s -m "Add draft: $title" - ''; - }; - }; -} diff --git a/sculpin/flake-modules/publish.nix b/sculpin/flake-modules/publish.nix deleted file mode 100644 index d15ee49aa..000000000 --- a/sculpin/flake-modules/publish.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ - perSystem = - { pkgs, ... }: - { - packages.publish = pkgs.writeShellApplication { - name = "publish"; - - runtimeInputs = with pkgs; [ - rsync - php - ]; - - text = '' - vendor/bin/sculpin generate --env prod - - rsync -uvrP static/ output_prod "$@" - rsync -uvrP output_prod/ nixedo.oliverdavies.uk:/var/www/vhosts/website-sculpin "$@" - ''; - }; - }; -} diff --git a/sculpin/flake-modules/systems.nix b/sculpin/flake-modules/systems.nix deleted file mode 100644 index ce708c68b..000000000 --- a/sculpin/flake-modules/systems.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - systems = [ "x86_64-linux" ]; -} diff --git a/sculpin/flake.lock b/sculpin/flake.lock index b94f97353..934192cd1 100644 --- a/sculpin/flake.lock +++ b/sculpin/flake.lock @@ -1,94 +1,23 @@ { "nodes": { - "devshell": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1741473158, - "narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=", - "owner": "numtide", - "repo": "devshell", - "rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, - "flake-parts": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib" - }, - "locked": { - "lastModified": 1754487366, - "narHash": "sha256-pHYj8gUBapuUzKV/kN/tR3Zvqc7o6gdFB9XKXIp1SQ8=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "af66ad14b28a127c5c0f3bbb298218fc63528a18", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "import-tree": { - "locked": { - "lastModified": 1752730890, - "narHash": "sha256-GES8fapSLGz36MMPRVNkSUWXUTtqvGQNXHjRmRLfJUY=", - "owner": "vic", - "repo": "import-tree", - "rev": "6ebb8cb87987b20264c09296166543fd3761d274", - "type": "github" - }, - "original": { - "owner": "vic", - "repo": "import-tree", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1755615617, - "narHash": "sha256-HMwfAJBdrr8wXAkbGhtcby1zGFvs+StOp19xNsbqdOg=", - "owner": "NixOS", + "lastModified": 1759381078, + "narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "20075955deac2583bb12f07151c2df830ef346b4", + "rev": "7df7ff7d8e00218376575f0acdcc5d66741351ee", "type": "github" }, "original": { - "owner": "NixOS", + "owner": "nixos", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs-lib": { - "locked": { - "lastModified": 1753579242, - "narHash": "sha256-zvaMGVn14/Zz8hnp4VWT9xVnhc8vuL3TStRqwk22biA=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "0f36c44e01a6129be94e3ade315a5883f0228a6e", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, "root": { "inputs": { - "devshell": "devshell", - "flake-parts": "flake-parts", - "import-tree": "import-tree", "nixpkgs": "nixpkgs" } } diff --git a/sculpin/flake.nix b/sculpin/flake.nix index bd0de9bc3..48d72aae6 100644 --- a/sculpin/flake.nix +++ b/sculpin/flake.nix @@ -1,20 +1,20 @@ { - inputs = { - devshell.inputs.nixpkgs.follows = "nixpkgs"; - devshell.url = "github:numtide/devshell"; + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - flake-parts.url = "github:hercules-ci/flake-parts"; - - import-tree.url = "github:vic/import-tree"; - - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - }; - - outputs = - inputs: - inputs.flake-parts.lib.mkFlake { inherit inputs; } { - imports = [ - (inputs.import-tree ./flake-modules) - ]; + outputs = inputs: + let + system = "x86_64-linux"; + pkgs = import inputs.nixpkgs { inherit system; }; + in + { + devShells.${system}.default = + with pkgs; + mkShell { + buildInputs = [ + nodePackages.browser-sync + php + phpPackages.composer + ]; + }; }; } diff --git a/sculpin/watch b/sculpin/watch new file mode 100755 index 000000000..03fac7d38 --- /dev/null +++ b/sculpin/watch @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -euo pipefail + +export PATH="$PATH:./vendor/bin" + +: "${APP_ENV:=dev}" + +sculpin generate \ + --env "$APP_ENV" \ + --server \ + --watch \ + "$@"